diff options
author | Sergio Martins <smartins@kde.org> | 2017-10-12 22:51:32 +0100 |
---|---|---|
committer | Sergio Martins <iamsergio@gmail.com> | 2017-10-12 22:51:32 +0100 |
commit | 6fddbb1aab9ee0aedadafc227d41c813079d76fd (patch) | |
tree | 12107711856d4bc206526150006fa81a076c794c /src | |
parent | 47842f2f59ed968a1d71fae182c3d2fa1e91aa75 (diff) |
Improve the warning message for some checks
Diffstat (limited to 'src')
-rw-r--r-- | src/checks/level0/lambda-in-connect.cpp | 2 | ||||
-rw-r--r-- | src/checks/level0/qcolor-from-literal.cpp | 4 | ||||
-rw-r--r-- | src/checks/level0/qfileinfo-exists.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/checks/level0/lambda-in-connect.cpp b/src/checks/level0/lambda-in-connect.cpp index 7ecbacf7..2e3f76ae 100644 --- a/src/checks/level0/lambda-in-connect.cpp +++ b/src/checks/level0/lambda-in-connect.cpp @@ -66,7 +66,7 @@ void LambdaInConnect::VisitStmt(clang::Stmt *stmt) if (capture.getCaptureKind() == clang::LCK_ByRef) { VarDecl *declForCapture = capture.getCapturedVar(); if (declForCapture && declForCapture != receiverDecl && ContextUtils::isValueDeclInFunctionContext(declForCapture)) - emitWarning(capture.getLocation(), "capturing local variable by reference in lambda"); + emitWarning(capture.getLocation(), "captured local variable by reference might go out of scope before lambda is called"); } } } diff --git a/src/checks/level0/qcolor-from-literal.cpp b/src/checks/level0/qcolor-from-literal.cpp index bff2a4d5..4daf712c 100644 --- a/src/checks/level0/qcolor-from-literal.cpp +++ b/src/checks/level0/qcolor-from-literal.cpp @@ -59,7 +59,7 @@ public : { const StringLiteral *lt = result.Nodes.getNodeAs<StringLiteral>("myLiteral"); if (handleStringLiteral(lt)) - m_check->emitWarning(lt, "The QColor ctor taking ints is much cheaper than the one taking string literals"); + m_check->emitWarning(lt, "The QColor ctor taking ints is cheaper than the one taking string literals"); } }; @@ -87,7 +87,7 @@ void QColorFromLiteral::VisitStmt(Stmt *stmt) StringLiteral *lt = HierarchyUtils::getFirstChildOfType2<StringLiteral>(call->getArg(0)); if (handleStringLiteral(lt)) - emitWarning(lt, "The ctor taking ints is much cheaper than QColor::setNamedColor(QString)"); + emitWarning(lt, "The ctor taking ints is cheaper than QColor::setNamedColor(QString)"); } void QColorFromLiteral::registerASTMatchers(MatchFinder &finder) diff --git a/src/checks/level0/qfileinfo-exists.cpp b/src/checks/level0/qfileinfo-exists.cpp index 78ab7855..041423d8 100644 --- a/src/checks/level0/qfileinfo-exists.cpp +++ b/src/checks/level0/qfileinfo-exists.cpp @@ -47,7 +47,7 @@ void QFileInfoExists::VisitStmt(clang::Stmt *stmt) if (!ctorExpr || StringUtils::simpleArgTypeName(ctorExpr->getConstructor(), 0, lo()) != "QString") return; - emitWarning(stmt->getLocStart(), "Use the static QFileInfo::exists() instead"); + emitWarning(stmt->getLocStart(), "Use the static QFileInfo::exists() instead. It's documented to be faster."); } |