[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Thu Mar 26 01:25:42 PDT 2015


 compilerplugins/clang/constantfunction.cxx |   37 ++++++-----------------------
 1 file changed, 8 insertions(+), 29 deletions(-)

New commits:
commit 82f4f6b19febb607d8823923380777f27e0ab3d9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 26 09:24:58 2015 +0100

    loplugins:constantfunction: properly detect overloaded operators
    
    Change-Id: I484e1206d1f17305d21f7e750b8aca9d1c8d809b

diff --git a/compilerplugins/clang/constantfunction.cxx b/compilerplugins/clang/constantfunction.cxx
index c3cd2b4..c89e6b7 100644
--- a/compilerplugins/clang/constantfunction.cxx
+++ b/compilerplugins/clang/constantfunction.cxx
@@ -160,13 +160,17 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
         return true;
     }
 
-    std::string aFunctionName = pFunctionDecl->getQualifiedNameAsString();
-
-    // various places override operator== and "return false;"
-    if (aFunctionName.find("::operator==") != std::string::npos ) {
+    switch (pFunctionDecl->getOverloadedOperator()) {
+    case OO_Delete:
+    case OO_EqualEqual:
+    case OO_Call:
         return true;
+    default:
+        break;
     }
 
+    std::string aFunctionName = pFunctionDecl->getQualifiedNameAsString();
+
     // something to do with dynamic loading in sal/textenc/textenc.cxx
     if (aFunctionName == "thisModule") {
         return true;
@@ -187,11 +191,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
     if (aFunctionName == "ExceptionThrower_acquire_release_nop") {
         return true;
     }
-    // /store/
-    if (aFunctionName == "store::PageData::operator delete"
-        || aFunctionName == "(anonymous namespace)::Entry::operator delete") {
-        return true;
-    }
     // differetnt hook function is called on different platforms, /vcl/source/app/svmainhook.cxx
     if (aFunctionName == "ImplSVMainHook") {
         return true;
@@ -244,10 +243,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
     if (aFunctionName == "SbxDecimal::neg" || aFunctionName == "SbxDecimal::isZero") {
         return true;
     }
-    // template stuff, include/sfx2/thumbnailview.hxx
-    if (aFunctionName == "ViewFilterAll::operator()") {
-        return true;
-    }
     // used as a callback, include/sfx2/shell.hxx
     if (aFunctionName == "SfxShell::EmptyExecStub" || aFunctionName == "SfxShell::EmptyStateStub"
         || aFunctionName == "SfxShell::VerbState") {
@@ -309,14 +304,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
     if (aFunctionName == "accessibility::CreateEmptyShapeReference") {
         return true;
     }
-    //  svx/source/inc/frmselimpl.hxx
-    if (aFunctionName == "svx::FrameBorderDummy_Pred::operator()") {
-        return true;
-    }
-    //  desktop/source/lib/init.cxx
-    if (aFunctionName == "NoDelete::operator()") {
-        return true;
-    }
     //  chart2/source/view/main/AbstractShapeFactory.cxx
     if (aFunctionName == "chart::(anonymous namespace)::thisModule") {
         return true;
@@ -325,10 +312,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
     if (aFunctionName == "chart::InternalData::dump") {
         return true;
     }
-    //  chart2/source/view/main/DummyXShape.cxx
-    if (aFunctionName == "chart::dummy::(anonymous namespace)::PrintProperties::operator()") {
-        return true;
-    }
     //  hwpfilter/
     if (aFunctionName == "debug" || aFunctionName == "token_debug") {
         return true;
@@ -353,10 +336,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
     if (aFunctionName == "SwWW8ImplReader::Read_F_Shape") {
         return true;
     }
-    // callback, sd/source/ui/framework/tools/FrameworkHelper.cxx
-    if (aFunctionName == "sd::framework::(anonymous namespace)::FrameworkHelperAllPassFilter::operator()") {
-        return true;
-    }
     // called from SDI file, I don't know what that stuff is about, sd/source/ui/slidesorter/shell/SlideSorterViewShell.cx
     if (aFunctionName == "sd::slidesorter::SlideSorterViewShell::ExecStatusBar"
         || aFunctionName == "sd::OutlineViewShell::ExecStatusBar") {


More information about the Libreoffice-commits mailing list