streamline containsWindowSubclass

Change-Id: I56d61b577df00855a49dd618e9dafcdb86cd7ca4
This commit is contained in:
Stephan Bergmann 2015-04-30 15:05:23 +02:00
parent 85895a76a4
commit a8174d258d

View File

@ -80,20 +80,18 @@ bool isDerivedFromWindow(const CXXRecordDecl *decl) {
bool containsWindowSubclass(const Type* pType0); bool containsWindowSubclass(const Type* pType0);
bool containsWindowSubclass(const QualType& qType) { bool containsWindowSubclass(const QualType& qType) {
if (startsWith(qType.getAsString(), "VclPtr")) auto t = qType->getAs<RecordType>();
return false; if (t != nullptr) {
if (startsWith(qType.getAsString(), "const VclPtr")) auto d = dyn_cast<ClassTemplateSpecializationDecl>(t->getDecl());
return false; if (d != nullptr) {
if (startsWith(qType.getAsString(), "class VclPtr")) std::string name(d->getQualifiedNameAsString());
return false; if (name == "ScopedVclPtr" || name == "ScopedVclPtrInstance"
if (startsWith(qType.getAsString(), "const class VclPtr")) || name == "VclPtr" || name == "VclPtrInstance")
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; return false;
}
}
}
return containsWindowSubclass(qType.getTypePtr()); return containsWindowSubclass(qType.getTypePtr());
} }