summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-12-18 14:16:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-12-18 22:43:29 +0100
commit35196c32751570d0c4b79f550d6c8723d2936f1c (patch)
tree5f4a56fb1dd921c59b56ee06249854f5bbc3ee4d /compilerplugins
parent83ff2a4f3824cbca7bc61a954aed840a21be4364 (diff)
loplugin:vclwidgets: Adapt check for 'assert' for MSVCRT
Change-Id: I12a77b5b53e3a674c1ff1554b560a71605e141a6
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 8a5ac72b97d2..3929cdf0e912 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -216,9 +216,17 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
}
}
}
- // checking for ParenExpr is a hacky way to ignore assert statements in older versions of clang (i.e. <= 3.2)
- if (!pCallExpr && !dyn_cast<ParenExpr>(*i))
- nNumExtraStatements++;
+ if (!pCallExpr) {
+ auto loc = (*i)->getLocStart();
+ if (!compiler.getSourceManager().isMacroBodyExpansion(loc)
+ || (Lexer::getImmediateMacroName(
+ loc, compiler.getSourceManager(),
+ compiler.getLangOpts())
+ != "assert"))
+ {
+ nNumExtraStatements++;
+ }
+ }
}
bOk = bFoundDisposeOnce && nNumExtraStatements == 0;
}