aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2017-10-12 19:51:16 +0100
committerSergio Martins <iamsergio@gmail.com>2017-10-12 19:51:16 +0100
commit9e850ca7b7d41ebf36a482f7144944ac3dc16dd4 (patch)
tree60e4eecad918e3491f8478467662fd11bd6a18ad /src
parent1b4c1c6dfc0a301c03804ddb43342e9f3b87e670 (diff)
qproperty-without-notify: Don't warn for Q_GADGETS
CCMAIL: jpnurmi@qt.io
Diffstat (limited to 'src')
-rw-r--r--src/checks/level1/qproperty-without-notify.cpp15
-rw-r--r--src/checks/level1/qproperty-without-notify.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
index 42a7948d..4922073d 100644
--- a/src/checks/level1/qproperty-without-notify.cpp
+++ b/src/checks/level1/qproperty-without-notify.cpp
@@ -41,7 +41,20 @@ QPropertyWithoutNotify::QPropertyWithoutNotify(const std::string &name, ClazyCon
void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok, const clang::SourceRange &range)
{
IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
- if (!ii || ii->getName() != "Q_PROPERTY")
+ if (!ii)
+ return;
+
+ if (ii->getName() == "Q_GADGET") {
+ m_lastIsGadget = true;
+ return;
+ }
+
+ if (ii->getName() == "Q_OBJECT") {
+ m_lastIsGadget = false;
+ return;
+ }
+
+ if (m_lastIsGadget || ii->getName() != "Q_PROPERTY")
return;
if (sm().isInSystemHeader(range.getBegin()))
diff --git a/src/checks/level1/qproperty-without-notify.h b/src/checks/level1/qproperty-without-notify.h
index 76d59deb..175924e6 100644
--- a/src/checks/level1/qproperty-without-notify.h
+++ b/src/checks/level1/qproperty-without-notify.h
@@ -35,6 +35,8 @@ public:
private:
void VisitMacroExpands(const clang::Token &MacroNameTok,
const clang::SourceRange &range) override;
+
+ bool m_lastIsGadget = false;
};
#endif