[clazy] [Bug 360338] New: qstring-ref check does not trigger for toFloat() calls on string temporaries

Volker Krause via KDE Bugzilla bugzilla_noreply at kde.org
Wed Mar 9 21:23:57 GMT 2016


https://bugs.kde.org/show_bug.cgi?id=360338

            Bug ID: 360338
           Summary: qstring-ref check does not trigger for toFloat() calls
                    on string temporaries
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: vkrause at kde.org
                CC: smartins at kde.org

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

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Unassigned-bugs mailing list