diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-30 15:05:23 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-30 16:59:08 +0200 |
commit | a8174d258d4ad1f151a245b80e5a9bbddc731f2a (patch) | |
tree | 0706ad4efb489a09f7786700e6db87750b3cd555 /compilerplugins | |
parent | 85895a76a436007cebc05f0da36e8b1cdb815868 (diff) |
streamline containsWindowSubclass
Change-Id: I56d61b577df00855a49dd618e9dafcdb86cd7ca4
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/vclwidgets.cxx | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index f984dcb2ec7b..a2f4ee15855e 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -80,20 +80,18 @@ bool isDerivedFromWindow(const CXXRecordDecl *decl) { bool containsWindowSubclass(const Type* pType0); bool containsWindowSubclass(const QualType& qType) { - if (startsWith(qType.getAsString(), "VclPtr")) - return false; - if (startsWith(qType.getAsString(), "const VclPtr")) - return false; - if (startsWith(qType.getAsString(), "class VclPtr")) - return false; - if (startsWith(qType.getAsString(), "const class VclPtr")) - return false; - if (startsWith(qType.getAsString(), "ScopedVclPtr")) - return false; - if (startsWith(qType.getAsString(), "class ScopedVclPtr")) - return false; - if (startsWith(qType.getAsString(), "const class ScopedVclPtr")) - return false; + auto t = qType->getAs<RecordType>(); + if (t != nullptr) { + auto d = dyn_cast<ClassTemplateSpecializationDecl>(t->getDecl()); + if (d != nullptr) { + std::string name(d->getQualifiedNameAsString()); + if (name == "ScopedVclPtr" || name == "ScopedVclPtrInstance" + || name == "VclPtr" || name == "VclPtrInstance") + { + return false; + } + } + } return containsWindowSubclass(qType.getTypePtr()); } |