diff options
author | Noel Grandin <noel@peralex.com> | 2015-07-07 13:58:41 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-07-08 09:51:27 +0200 |
commit | 449d272daf5e99f039cdfdd25f020bd798fb9e1d (patch) | |
tree | fad3597606f3fbae275ff990aac45ad8f00e1c86 /compilerplugins | |
parent | b43fde69caf456585004b3e1da5161d76eadf057 (diff) |
loplugin:unusedmethods vcl
Change-Id: I98b88ca3369a2c888fd63796e39d42376d513002
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/unusedmethods.cxx | 15 | ||||
-rwxr-xr-x | compilerplugins/clang/unusedmethods.py | 13 |
2 files changed, 24 insertions, 4 deletions
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx index 7dc57e9b88c7..28683347fa1d 100644 --- a/compilerplugins/clang/unusedmethods.cxx +++ b/compilerplugins/clang/unusedmethods.cxx @@ -137,18 +137,25 @@ static bool isStandardStuff(const std::string& s) || startsWith(s, "(anonymous namespace)::"); } +// prevent recursive templates from blowing up the stack +static std::set<std::string> traversedTemplateFunctionSet; + bool UnusedMethods::VisitCallExpr(CallExpr* expr) { if (ignoreLocation(expr)) { return true; } FunctionDecl* calleeFunctionDecl = expr->getDirectCallee(); - // if we see a call to a templated method, it effectively instantiates a new method, - // so we need to examine it's interior to see if it in turn calls anything else - if (calleeFunctionDecl->getTemplatedKind() != clang::FunctionDecl::TemplatedKind::TK_NonTemplate + if (calleeFunctionDecl == nullptr) { + return true; + } + // if we see a call to a templated function, it effectively creates new code, + // so we need to examine it's interior to see if it, in turn, calls anything else + if (calleeFunctionDecl->getTemplatedKind() != FunctionDecl::TemplatedKind::TK_NonTemplate || calleeFunctionDecl->isFunctionTemplateSpecialization()) { - TraverseFunctionDecl(calleeFunctionDecl); + if (traversedTemplateFunctionSet.insert(calleeFunctionDecl->getQualifiedNameAsString()).second) + TraverseFunctionDecl(calleeFunctionDecl); } CXXMethodDecl* calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(calleeFunctionDecl); diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py index 22d7089b93df..69a253a28650 100755 --- a/compilerplugins/clang/unusedmethods.py +++ b/compilerplugins/clang/unusedmethods.py @@ -32,6 +32,19 @@ exclusionSet = set([ # used by Windows build "_Bool basegfx::B2ITuple::equalZero() const", "class basegfx::B2DPolyPolygon basegfx::unotools::UnoPolyPolygon::getPolyPolygonUnsafe() const", + "void OpenGLContext::requestSingleBufferedRendering()", + "_Bool TabitemValue::isBothAligned() const", + "_Bool TabitemValue::isNotAligned() const", + "void StyleSettings::SetSpinSize(long)", + "void StyleSettings::SetFloatTitleHeight(long)", + "void StyleSettings::SetTitleHeight(long)", + "void StyleSettings::SetUseFlatBorders(_Bool)", + "void StyleSettings::SetUseFlatMenus(_Bool)", + "void StyleSettings::SetCursorSize(long)", + "_Bool CommandMediaData::GetPassThroughToOS() const", + "void Application::AppEvent(const class ApplicationEvent &)", + # instantiated from a template in VCL, not sure why it is not being picked up + "class basegfx::B2DPolygon OutputDevice::PixelToLogic(const class basegfx::B2DPolygon &,const class MapMode &) const", ]) |