summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/sfxpoolitem.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-26 15:36:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 12:49:42 +0000
commit994e38e336beeacbd983faafac480afc94d3947e (patch)
treef6dd4fc3427d9051701637d2d052a9a51bb76c88 /compilerplugins/clang/sfxpoolitem.cxx
parenteb6c18dfbeb7d2ad20ba7221d156969bd754faed (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/sfxpoolitem.cxx')
-rw-r--r--compilerplugins/clang/sfxpoolitem.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/compilerplugins/clang/sfxpoolitem.cxx b/compilerplugins/clang/sfxpoolitem.cxx
index f01adf578235..b18251795486 100644
--- a/compilerplugins/clang/sfxpoolitem.cxx
+++ b/compilerplugins/clang/sfxpoolitem.cxx
@@ -12,6 +12,7 @@
#include "plugin.hxx"
#include "compat.hxx"
+#include "check.hxx"
#include "clang/AST/CXXInheritance.h"
/*
@@ -39,7 +40,7 @@ bool BaseCheckNotSfxPoolItemSubclass(
#endif
)
{
- if (BaseDefinition && BaseDefinition->getQualifiedNameAsString() == "SfxPoolItem") {
+ if (BaseDefinition && loplugin::TypeCheck(BaseDefinition).Class("SfxPoolItem").GlobalNamespace()) {
return false;
}
return true;
@@ -48,7 +49,7 @@ bool BaseCheckNotSfxPoolItemSubclass(
bool isDerivedFromSfxPoolItem(const CXXRecordDecl *decl) {
if (!decl)
return false;
- if (decl->getQualifiedNameAsString() == "SfxPoolItem")
+ if (loplugin::TypeCheck(decl).Class("SfxPoolItem").GlobalNamespace())
return true;
if (!decl->hasDefinition()) {
return false;
@@ -70,7 +71,7 @@ bool BaseCheckNotSwMsgPoolItemSubclass(
#endif
)
{
- if (BaseDefinition && BaseDefinition->getQualifiedNameAsString() == "SwMsgPoolItem") {
+ if (BaseDefinition && loplugin::TypeCheck(BaseDefinition).Class("SwMsgPoolItem")) {
return false;
}
return true;
@@ -79,7 +80,7 @@ bool BaseCheckNotSwMsgPoolItemSubclass(
bool isDerivedFromSwMsgPoolItem(const CXXRecordDecl *decl) {
if (!decl)
return false;
- if (decl->getQualifiedNameAsString() == "SwMsgPoolItem")
+ if (loplugin::TypeCheck(decl).Class("SwMsgPoolItem").GlobalNamespace())
return true;
if (!decl->hasDefinition()) {
return false;
@@ -118,12 +119,12 @@ bool SfxPoolItem::VisitCXXRecordDecl(const CXXRecordDecl* decl)
return true;
}
// the enum types do some weird stuff involving SfxEnumItemInterface
- std::string sRecordName = decl->getQualifiedNameAsString();
- if (sRecordName == "SfxEnumItem" || sRecordName == "SfxAllEnumItem")
+ auto tc = loplugin::TypeCheck(decl);
+ if (tc.Class("SfxEnumItem").GlobalNamespace() || tc.Class("SfxAllEnumItem").GlobalNamespace())
return true;
// the new field is only used for reading and writing to storage
- if (sRecordName == "SvxCharSetColorItem")
+ if (tc.Class("SvxCharSetColorItem").GlobalNamespace())
return true;
for (auto it = decl->method_begin(); it != decl->method_end(); ++it) {