diff options
author | David Faure <faure@kde.org> | 2018-12-02 23:31:04 +0100 |
---|---|---|
committer | Sergio Martins <smartins@kde.org> | 2018-12-03 19:04:28 +0000 |
commit | 9d6ae8b4d940776f64f6b1cf558b0f826aa9c816 (patch) | |
tree | 1b8ad6430ae89eb4554007b3fb7f23ae57e0c9f7 | |
parent | ad8e58e41537a9656b7924b5447fdb6e7bbad43e (diff) |
emit from a constructor can be correct, if a connect happens in the ctor.
-rw-r--r-- | docs/checks/README-incorrect-emit.md | 3 | ||||
-rw-r--r-- | src/checks/level1/incorrect-emit.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/docs/checks/README-incorrect-emit.md b/docs/checks/README-incorrect-emit.md index 09640675..a97e36a4 100644 --- a/docs/checks/README-incorrect-emit.md +++ b/docs/checks/README-incorrect-emit.md @@ -5,4 +5,5 @@ Conversely, you should not use those macros when calling a non-signal. clazy will warn if you forget to use emit (or Q_EMIT) or if you use them on a non-signal. -Additionally, it will warn when emitting a signal from a constructor, because there's nothing connected to the signal yet. +Additionally, it will warn when emitting a signal from a constructor, because there's likely nothing connected to the signal yet +(it could happen though, if the constructor itself, or something called by it, connects to that signal). diff --git a/src/checks/level1/incorrect-emit.cpp b/src/checks/level1/incorrect-emit.cpp index 1b6bbcdb..f9bcd8c1 100644 --- a/src/checks/level1/incorrect-emit.cpp +++ b/src/checks/level1/incorrect-emit.cpp @@ -116,7 +116,7 @@ void IncorrectEmit::checkCallSignalInsideCTOR(CXXMemberCallExpr *callExpr) if (clazy::getFirstParentOfType<LambdaExpr>(m_context->parentMap, callExpr) != nullptr) return; // Emit is inside a lambda, it's fine - emitWarning(getLocStart(callExpr), "Emitting inside constructor has no effect"); + emitWarning(getLocStart(callExpr), "Emitting inside constructor probably has no effect"); } bool IncorrectEmit::hasEmitKeyboard(CXXMemberCallExpr *call) const |