From 35196c32751570d0c4b79f550d6c8723d2936f1c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sun, 18 Dec 2016 14:16:34 +0100 Subject: loplugin:vclwidgets: Adapt check for 'assert' for MSVCRT Change-Id: I12a77b5b53e3a674c1ff1554b560a71605e141a6 --- compilerplugins/clang/vclwidgets.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'compilerplugins') 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(*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; } -- cgit