diff options
author | Sergio Martins <smartins@kde.org> | 2019-09-29 19:54:45 +0100 |
---|---|---|
committer | Sergio Martins <smartins@kde.org> | 2019-09-29 20:03:04 +0100 |
commit | 1edd1c50b6b6c03edb5c2f8e3d16596353a025c8 (patch) | |
tree | 72258b533f594f370ce70d4770f94c987b93c3da /src | |
parent | 23c461c059b2caed618e59749bb22ded57498792 (diff) |
qproperty-type-mismatch: fix a bunch of false positives
Namely enums and bool properties. Enums had the enum tag
when printing, and bool was Bool_.
Diffstat (limited to 'src')
-rw-r--r-- | src/checks/manuallevel/qproperty-type-mismatch.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp index 5fb520bf..75788fcf 100644 --- a/src/checks/manuallevel/qproperty-type-mismatch.cpp +++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp @@ -101,16 +101,12 @@ void QPropertyTypeMismatch::VisitField(const FieldDecl & field) std::string QPropertyTypeMismatch::cleanupType(QualType type) { type = type.getNonReferenceType().getCanonicalType().getUnqualifiedType(); - //type.removeLocalCVRQualifiers(Qualifiers::CVRMask); - std::string str = type.getAsString(); - if(str.compare(0, 6, "class ") == 0) - str = str.substr(6); - else if(str.compare(0, 7, "struct ") == 0) - str = str.substr(7); + PrintingPolicy po(lo()); + po.SuppressTagKeyword = true; + std::string str = type.getAsString(po); str.erase(std::remove_if(str.begin(), str.end(), [] (char c) { return std::isspace(c); }), str.end()); - return str; } |