loplugin:vclwidgets: Adapt check for 'assert' for MSVCRT

Change-Id: I12a77b5b53e3a674c1ff1554b560a71605e141a6
This commit is contained in:
Stephan Bergmann 2016-12-18 14:16:34 +01:00
parent 83ff2a4f38
commit 35196c3275

View File

@ -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;
}