compilerplugins/clang/vclwidgets.cxx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
New commits: commit 08967d36ba0da5bf85e52ff64f41732a12b37a2e Author: Noel Grandin <[email protected]> Date: Thu May 7 11:18:25 2015 +0200 workaround for clang3.2 in vclwidgets clang plugin Change-Id: I7ac67dd14d14a93fe163febe0f18df56dd613376 diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index 2e7d4eb..a09f8db 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -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( commit 4eeaaf84d4251d77a86155609e21f86add086f3f Author: Noel Grandin <[email protected]> Date: Thu May 7 11:05:02 2015 +0200 fix comment Change-Id: Ifa59bdc4bfd80fe3100ba5f1ac8119ad990e3936 diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index 77a8476..2e7d4eb 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -184,7 +184,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD << pCXXDestructorDecl->getSourceRange(); return true; } - // check that the destructor for a OutputDevice subclass does nothing except call into the dispose() method + // 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()); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
