Bug 360338 - qstring-ref check does not trigger for toFloat() calls on string temporaries
Summary: qstring-ref check does not trigger for toFloat() calls on string temporaries
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-09 21:23 UTC by Volker Krause
Modified: 2016-03-13 13:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Krause 2016-03-09 21:23:57 UTC
qtdeclarative/src/quick/util/qquickglobal.cpp contains example code that should trigger (s.left/mid().toFloat()), but does not.

This seems to fix it:

diff --git a/checks/qstringref.cpp b/checks/qstringref.cpp
index 1ef8e88..45b5920 100644
--- a/checks/qstringref.cpp
+++ b/checks/qstringref.cpp
@@ -58,7 +58,7 @@ static bool isInterestingSecondMethod(CXXMethodDecl *method, const clang::LangOp
         return false;
 
     static const vector<string> list = { "compare", "contains", "count", "startsWith", "endsWith", "indexOf",
-                                         "isEmpty", "isNull", "lastIndexOf", "length", "size", "toDouble", "toInt",
+                                         "isEmpty", "isNull", "lastIndexOf", "length", "size", "toDouble", "toFloat", "toInt",
                                          "toUInt", "toULong", "toULongLong", "toUShort", "toUcs4"};
 
     if (!clazy_std::contains(list, method->getNameAsString()))


Reproducible: Always
Comment 1 Sergio Martins 2016-03-13 13:02:41 UTC
Git commit 1c0c5b24c2ac7599459754f1d0e2d9201c983c5d by Sergio Martins, on behalf of Volker Krause.
Committed on 13/03/2016 at 13:02.
Pushed by smartins into branch 'master'.

qstring-ref: also trigger on QString::toFloat()

M  +2    -2    checks/qstringref.cpp

http://commits.kde.org/clazy/1c0c5b24c2ac7599459754f1d0e2d9201c983c5d