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/weakobject.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/weakobject.cxx')
-rw-r--r-- | compilerplugins/clang/weakobject.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compilerplugins/clang/weakobject.cxx b/compilerplugins/clang/weakobject.cxx index 7c36f93a1d92..9ccbb8ac3c86 100644 --- a/compilerplugins/clang/weakobject.cxx +++ b/compilerplugins/clang/weakobject.cxx @@ -117,8 +117,8 @@ public: // Allow this convenient shortcut: auto td = dyn_cast<TypeDecl>(pCalled->getParent()); if (td != nullptr - && (loplugin::TypeCheck(QualType(td->getTypeForDecl(), 0)).Class("OWeakObject").Namespace("cppu") - || loplugin::TypeCheck(QualType(td->getTypeForDecl(), 0)).Class("OWeakAggObject").Namespace("cppu"))) + && (loplugin::TypeCheck(td).Class("OWeakObject").Namespace("cppu").GlobalNamespace() + || loplugin::TypeCheck(td).Class("OWeakAggObject").Namespace("cppu").GlobalNamespace())) { return true; } @@ -131,15 +131,15 @@ public: } // whitelist - auto const name(pMethodDecl->getParent()->getQualifiedNameAsString()); - if ( name == "cppu::OWeakAggObject" // conditional call - || name == "cppu::WeakComponentImplHelperBase" // extra magic - || name == "cppu::WeakAggComponentImplHelperBase" // extra magic - || name == "DOM::CDOMImplementation" // a static oddity - || name == "SwXTextFrame" // ambiguous, 3 parents - || name == "SwXTextDocument" // ambiguous, ~4 parents - || name == "SdStyleSheet" // same extra magic as WeakComponentImplHelperBase - || name == "SdXImpressDocument" // same extra magic as WeakComponentImplHelperBase + auto tc = loplugin::TypeCheck(pMethodDecl->getParent()); + if ( tc.Class("OWeakAggObject").Namespace("cppu").GlobalNamespace() // conditional call + || tc.Class("WeakComponentImplHelperBase").Namespace("cppu").GlobalNamespace() // extra magic + || tc.Class("WeakAggComponentImplHelperBase").Namespace("cppu").GlobalNamespace() // extra magic + || tc.Class("CDOMImplementation").Namespace("DOM").GlobalNamespace() // a static oddity + || tc.Class("SwXTextFrame").GlobalNamespace() // ambiguous, 3 parents + || tc.Class("SwXTextDocument").GlobalNamespace() // ambiguous, ~4 parents + || tc.Class("SdStyleSheet").GlobalNamespace() // same extra magic as WeakComponentImplHelperBase + || tc.Class("SdXImpressDocument").GlobalNamespace() // same extra magic as WeakComponentImplHelperBase ) { return true; |