summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 09:24:58 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 09:25:13 +0100
commit82f4f6b19febb607d8823923380777f27e0ab3d9 (patch)
tree1a5e2d60da8e554d2a3e0ed67ea2fc495339bfd3 /compilerplugins
parent81e43176d838920743b5cb226f9ea9509eb1036c (diff)
loplugins:constantfunction: properly detect overloaded operators
Change-Id: I484e1206d1f17305d21f7e750b8aca9d1c8d809b
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/constantfunction.cxx37
1 files changed, 8 insertions, 29 deletions
diff --git a/compilerplugins/clang/constantfunction.cxx b/compilerplugins/clang/constantfunction.cxx
index c3cd2b43bf73..c89e6b76598c 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") {