diff options
-rw-r--r-- | compilerplugins/clang/singlevalfields.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/store/constantfunction.cxx | 8 | ||||
-rw-r--r-- | compilerplugins/clang/store/returnbyref.cxx | 4 |
3 files changed, 12 insertions, 2 deletions
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx index 491d260d6d31..c858954745f9 100644 --- a/compilerplugins/clang/singlevalfields.cxx +++ b/compilerplugins/clang/singlevalfields.cxx @@ -258,7 +258,7 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr ) std::string assignValue; // check for field being returned by non-const ref eg. Foo& getFoo() { return f; } - if (parent && isa<ReturnStmt>(parent)) { + if (parentFunction && parent && isa<ReturnStmt>(parent)) { const Stmt* parent2 = parentStmt(parent); if (parent2 && isa<CompoundStmt>(parent2)) { QualType qt = compat::getReturnType(*parentFunction).getDesugaredType(compiler.getASTContext()); diff --git a/compilerplugins/clang/store/constantfunction.cxx b/compilerplugins/clang/store/constantfunction.cxx index cd14c48d981a..20f69712fa07 100644 --- a/compilerplugins/clang/store/constantfunction.cxx +++ b/compilerplugins/clang/store/constantfunction.cxx @@ -67,6 +67,12 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) { if (pFunctionDecl->isExternC()) { return true; } + if (pFunctionDecl->isConstexpr()) { + return true; + } + if (pFunctionDecl->isMain()) { + return true; + } StringRef aFileName = getFilename(pFunctionDecl); @@ -151,7 +157,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) { if (isa<CXXConstructorDecl>(pFunctionDecl) || isa<CXXDestructorDecl>(pFunctionDecl) || isa<CXXConversionDecl>(pFunctionDecl)) { return true; } - SourceLocation canonicalLoc = pFunctionDecl->getCanonicalDecl()->getNameInfo().getLoc(); if (isInUnoIncludeFile(pFunctionDecl)) { return true; } @@ -429,6 +434,7 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) { + std::string aImmediateMacro = ""; if (compiler.getSourceManager().isMacroBodyExpansion(pFunctionDecl->getLocStart()) ) { StringRef name { Lexer::getImmediateMacroName( diff --git a/compilerplugins/clang/store/returnbyref.cxx b/compilerplugins/clang/store/returnbyref.cxx index aacfd7d833cf..9fa66131a880 100644 --- a/compilerplugins/clang/store/returnbyref.cxx +++ b/compilerplugins/clang/store/returnbyref.cxx @@ -73,6 +73,10 @@ bool ReturnByRef::VisitCXXMethodDecl(const CXXMethodDecl * functionDecl) { if ( functionDecl->getNameAsString() == "operator->") { return true; } + std::string aFunctionName = functionDecl->getQualifiedNameAsString(); + if (aFunctionName == "SbxValue::data") { + return true; + } /* std::string aParentName = functionDecl->getParent()->getQualifiedNameAsString(); std::string fqn = aParentName + "::" + functionDecl->getNameAsString(); |