Kaydet (Commit) 08967d36 authored tarafından Noel Grandin's avatar Noel Grandin

workaround for clang3.2 in vclwidgets clang plugin

Change-Id: I7ac67dd14d14a93fe163febe0f18df56dd613376
üst 4eeaaf84
......@@ -186,16 +186,25 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
}
// check that the destructor for a OutputDevice subclass does nothing except call into the disposeOnce() method
bool ok = false;
if (pCompoundStatement && pCompoundStatement->size() == 1) {
const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_begin());
if (pCallExpr) {
if( const FunctionDecl* func = pCallExpr->getDirectCallee()) {
if( func->getNumParams() == 0 && func->getIdentifier() != NULL
&& ( func->getName() == "disposeOnce" )) {
ok = true;
if (pCompoundStatement) {
bool bFoundDisposeOnce = false;
int nNumExtraStatements = 0;
for(auto const * x : pCompoundStatement->body())
{
const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(x);
if (pCallExpr) {
if( const FunctionDecl* func = pCallExpr->getDirectCallee()) {
if( func->getNumParams() == 0 && func->getIdentifier() != NULL
&& ( func->getName() == "disposeOnce" )) {
bFoundDisposeOnce = true;
}
}
}
// 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>(x))
nNumExtraStatements++;
}
ok = bFoundDisposeOnce && nNumExtraStatements == 0;
}
if (!ok) {
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment