diff options
author | Sergio Martins <smartins@kde.org> | 2017-10-12 22:26:14 +0100 |
---|---|---|
committer | Sergio Martins <iamsergio@gmail.com> | 2017-10-12 22:28:30 +0100 |
commit | 47842f2f59ed968a1d71fae182c3d2fa1e91aa75 (patch) | |
tree | af8721c84bd35bd70a7aecb3c5fa4defb2a72b5c /src | |
parent | 175b6d12c9fe22de1ee854a1c8113ee03954a320 (diff) |
qenums: Don't warn when importing enums from other classes
Q_ENUM() doesn't support that
Diffstat (limited to 'src')
-rw-r--r-- | src/checks/level0/qenums.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp index 5bf2c14d..68ae409c 100644 --- a/src/checks/level0/qenums.cpp +++ b/src/checks/level0/qenums.cpp @@ -52,6 +52,16 @@ void Qenums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran if (!ii || ii->getName() != "Q_ENUMS") return; + { + // Don't warn when importing enums of other classes, because Q_ENUM doesn't support it. + // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor + + CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo()); + string text = Lexer::getSourceText(crange, sm(), lo()); + if (clazy_std::contains(text, "::")) + return; + } + if (range.getBegin().isMacroID()) return; |