summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/staticmethods.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-28 17:48:22 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-28 17:48:22 +0200
commitc1ab6613ae7b45f2d90aafd6c6a829a471ceca55 (patch)
tree4a105e4b56a05e71b70976bf49ec8adf4eaee8db /compilerplugins/clang/staticmethods.cxx
parentDon't call a function when its result is already stored in variable (diff)
downloadcore-c1ab6613ae7b45f2d90aafd6c6a829a471ceca55.tar.gz
core-c1ab6613ae7b45f2d90aafd6c6a829a471ceca55.zip
More adaption to Clang 3.4
...where NmaedDecl::getQualifiedNameAsString (which is expensive and bad, anyway) apparently returns something other than "(anonymous namespace)" Change-Id: I05ef96665c48f8f596dd0d317388e91a75b8307b
Diffstat (limited to 'compilerplugins/clang/staticmethods.cxx')
-rw-r--r--compilerplugins/clang/staticmethods.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index be014fd1630d..9108e0236d65 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -9,8 +9,9 @@
#include "clang/AST/Attr.h"
-#include "plugin.hxx"
#include "compat.hxx"
+#include "plugin.hxx"
+#include "typecheck.hxx"
/*
Look for member functions that can be static
@@ -118,12 +119,14 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl)
}
// can't change it because in debug mode it can't be static
// sal/cpprt/operators_new_delete.cxx
- if (aParentName == "(anonymous namespace)::AllocatorTraits") {
+ auto dc = loplugin::DeclCheck(pCXXMethodDecl->getParent());
+ if (dc.Struct("AllocatorTraits").AnonymousNamespace().GlobalNamespace()) {
return true;
}
// in this case, the code is taking the address of the member function
// shell/source/unix/sysshell/recently_used_file_handler.cxx
- if (aParentName == "(anonymous namespace)::recently_used_item") {
+ if (dc.Struct("recently_used_item").AnonymousNamespace().GlobalNamespace())
+ {
return true;
}
// the unotools and svl config code stuff is doing weird stuff with a reference-counted statically allocated pImpl class