diff options
Diffstat (limited to 'src/checks/level0/lambda-in-connect.cpp')
-rw-r--r-- | src/checks/level0/lambda-in-connect.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/checks/level0/lambda-in-connect.cpp b/src/checks/level0/lambda-in-connect.cpp index 2e3f76ae..52c3e7e1 100644 --- a/src/checks/level0/lambda-in-connect.cpp +++ b/src/checks/level0/lambda-in-connect.cpp @@ -22,7 +22,6 @@ #include "lambda-in-connect.h" #include "ClazyContext.h" #include "Utils.h" -#include "checkmanager.h" #include "StringUtils.h" #include "HierarchyUtils.h" #include "ContextUtils.h" @@ -35,7 +34,7 @@ using namespace std; LambdaInConnect::LambdaInConnect(const std::string &name, ClazyContext *context) - : CheckBase(name, context) + : CheckBase(name, context, Option_CanIgnoreIncludes) { } @@ -49,27 +48,24 @@ void LambdaInConnect::VisitStmt(clang::Stmt *stmt) if (captures.begin() == captures.end()) return; - auto callExpr = HierarchyUtils::getFirstParentOfType<CallExpr>(m_context->parentMap, lambda); - if (StringUtils::qualifiedMethodName(callExpr) != "QObject::connect") + auto callExpr = clazy::getFirstParentOfType<CallExpr>(m_context->parentMap, lambda); + if (clazy::qualifiedMethodName(callExpr) != "QObject::connect") return; - ValueDecl *senderDecl = QtUtils::signalSenderForConnect(callExpr); + ValueDecl *senderDecl = clazy::signalSenderForConnect(callExpr); if (senderDecl) { const Type *t = senderDecl->getType().getTypePtrOrNull(); if (t && !t->isPointerType()) return; } - ValueDecl *receiverDecl = QtUtils::signalReceiverForConnect(callExpr); + ValueDecl *receiverDecl = clazy::signalReceiverForConnect(callExpr); for (auto capture : captures) { if (capture.getCaptureKind() == clang::LCK_ByRef) { VarDecl *declForCapture = capture.getCapturedVar(); - if (declForCapture && declForCapture != receiverDecl && ContextUtils::isValueDeclInFunctionContext(declForCapture)) + if (declForCapture && declForCapture != receiverDecl && clazy::isValueDeclInFunctionContext(declForCapture)) emitWarning(capture.getLocation(), "captured local variable by reference might go out of scope before lambda is called"); } } } - - -REGISTER_CHECK("lambda-in-connect", LambdaInConnect, CheckLevel0) |