diff options
-rw-r--r-- | compilerplugins/clang/vclwidgets.cxx | 14 |
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; } |