diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-26 15:36:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-01 12:49:42 +0000 |
commit | 994e38e336beeacbd983faafac480afc94d3947e (patch) | |
tree | f6dd4fc3427d9051701637d2d052a9a51bb76c88 /compilerplugins/clang/rendercontext.cxx | |
parent | eb6c18dfbeb7d2ad20ba7221d156969bd754faed (diff) |
loplugin: use TypeCheck instead of getQualifiedNameAsString
since the latter is rather slow
Change-Id: Ib73cdb923585580777c2265b561c1808e93b2baa
Reviewed-on: https://gerrit.libreoffice.org/33585
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/rendercontext.cxx')
-rw-r--r-- | compilerplugins/clang/rendercontext.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compilerplugins/clang/rendercontext.cxx b/compilerplugins/clang/rendercontext.cxx index e3d1da40ae1e..2ea4a0c3380b 100644 --- a/compilerplugins/clang/rendercontext.cxx +++ b/compilerplugins/clang/rendercontext.cxx @@ -11,6 +11,7 @@ #include <iostream> #include "plugin.hxx" +#include "check.hxx" #include "clang/AST/CXXInheritance.h" // Check for calls to OutputDevice methods that are not passing through RenderContext @@ -51,15 +52,13 @@ bool RenderContext::TraverseFunctionDecl(const FunctionDecl * pFunctionDecl) // Ignore methods inside the OutputDevice class const CXXMethodDecl *pCXXMethodDecl = dyn_cast<CXXMethodDecl>(pFunctionDecl); if (pCXXMethodDecl) { - std::string aParentName = pCXXMethodDecl->getParent()->getQualifiedNameAsString(); - if (aParentName == "OutputDevice") + if (loplugin::TypeCheck(pCXXMethodDecl->getParent()).Class("OutputDevice").GlobalNamespace()) return true; } // we are only currently interested in methods where the first parameter is RenderContext if (pFunctionDecl->getNumParams() == 0) return true; - string arg0 = pFunctionDecl->getParamDecl( 0 )->getType().getAsString(); - if ( arg0.find("RenderContext") != std::string::npos ) { + if ( loplugin::TypeCheck(pFunctionDecl->getParamDecl( 0 )->getType()).Class("RenderContext").GlobalNamespace() ) { return true; } mbChecking = true; @@ -76,7 +75,7 @@ bool RenderContext::VisitCXXMemberCallExpr(const CXXMemberCallExpr* pCXXMemberCa return true; } const CXXRecordDecl *pCXXRecordDecl = pCXXMemberCallExpr->getRecordDecl(); - if (pCXXRecordDecl->getQualifiedNameAsString() != "OutputDevice") { + if (!loplugin::TypeCheck(pCXXRecordDecl).Class("OutputDevice").GlobalNamespace()) { return true; } // ignore a handful of methods. They will most probably still be present in Window for use during processing outside of the Paint() |