diff options
| -rw-r--r-- | Changelog | 3 | ||||
| -rw-r--r-- | CheckSources.generated.cmake | 1 | ||||
| -rw-r--r-- | ClazyTests.generated.cmake | 1 | ||||
| -rw-r--r-- | HOWTO.md | 1 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | checks.json | 13 | ||||
| -rw-r--r-- | docs/checks/README-qstring-ref.md | 16 | ||||
| -rw-r--r-- | readmes.cmake | 1 | ||||
| -rw-r--r-- | src/Checks.h | 3 | ||||
| -rw-r--r-- | src/checks/level0/qstring-ref.cpp | 230 | ||||
| -rw-r--r-- | src/checks/level0/qstring-ref.h | 41 | ||||
| -rw-r--r-- | tests/clazy/test_requested_checks.sh.expected | 33 | ||||
| -rw-r--r-- | tests/qstring-ref/bug376737.cpp | 15 | ||||
| -rw-r--r-- | tests/qstring-ref/bug376737.cpp.expected | 0 | ||||
| -rw-r--r-- | tests/qstring-ref/config.json | 12 | ||||
| -rw-r--r-- | tests/qstring-ref/main.cpp | 34 | ||||
| -rw-r--r-- | tests/qstring-ref/main.cpp.expected | 5 |
17 files changed, 19 insertions, 393 deletions
@@ -1,4 +1,4 @@ -Version 1.16 +Version 1.17 ~~~~~~~~~~~~ Released: not yet @@ -9,6 +9,7 @@ Bugfixes: * detaching-temporary properly checks conditions when more than two method calls are chained * Fixits for detaching-temporary/detaching-member are more reliable with fixit ranges for operator calls * When using QT_NAMESPACE, clazy properly handles Qt classes being in this specific namespace + * Remove check qstring-ref as Qt 6 dropped QStringRef. Notes: * C++20 is now required for compilation diff --git a/CheckSources.generated.cmake b/CheckSources.generated.cmake index 5cc63065..288479ee 100644 --- a/CheckSources.generated.cmake +++ b/CheckSources.generated.cmake @@ -51,7 +51,6 @@ set(CLAZY_CHECKS_SRCS ${CLAZY_CHECKS_SRCS} ${CMAKE_CURRENT_LIST_DIR}/src/checks/level0/qstring-arg.cpp ${CMAKE_CURRENT_LIST_DIR}/src/checks/level0/qstring-comparison-to-implicit-char.cpp ${CMAKE_CURRENT_LIST_DIR}/src/checks/level0/qstring-insensitive-allocation.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/checks/level0/qstring-ref.cpp ${CMAKE_CURRENT_LIST_DIR}/src/checks/level0/qt-macros.cpp ${CMAKE_CURRENT_LIST_DIR}/src/checks/level0/strict-iterators.cpp ${CMAKE_CURRENT_LIST_DIR}/src/checks/level0/temporary-iterator.cpp diff --git a/ClazyTests.generated.cmake b/ClazyTests.generated.cmake index fb5b5bd6..68b3e246 100644 --- a/ClazyTests.generated.cmake +++ b/ClazyTests.generated.cmake @@ -50,7 +50,6 @@ add_clazy_test(qmap-with-pointer-key) add_clazy_test(qstring-arg) add_clazy_test(qstring-comparison-to-implicit-char) add_clazy_test(qstring-insensitive-allocation) -add_clazy_test(qstring-ref) add_clazy_test(qt-macros) add_clazy_test(strict-iterators) add_clazy_test(temporary-iterator) @@ -64,7 +64,6 @@ which will generate the files you need to write, and edit others for you. qgetenv.cpp functionargsbyref.cpp autounexpectedqstringbuilder.cpp - qstringref.cpp ``` # Running tests @@ -272,7 +272,6 @@ clazy runs all checks from level1 by default. - [qstring-arg](docs/checks/README-qstring-arg.md) - [qstring-comparison-to-implicit-char](docs/checks/README-qstring-comparison-to-implicit-char.md) - [qstring-insensitive-allocation](docs/checks/README-qstring-insensitive-allocation.md) - - [qstring-ref](docs/checks/README-qstring-ref.md) (fix-missing-qstringref) - [qt-macros](docs/checks/README-qt-macros.md) - [strict-iterators](docs/checks/README-strict-iterators.md) - [temporary-iterator](docs/checks/README-temporary-iterator.md) @@ -395,7 +394,7 @@ For example `-checks=clazy-qdatetime-utc,clazy-qgetenv"` <!-- jq -r '[.checks[] | select(.level == 0) | "clazy-" + .name] | join(",")' checks.json --> To enable all checks from level0 use: -`clazy-overloaded-signal,clazy-connect-by-name,clazy-connect-non-signal,clazy-qstring-comparison-to-implicit-char,clazy-wrong-qevent-cast,clazy-lambda-in-connect,clazy-lambda-unique-connection,clazy-qdatetime-utc,clazy-qgetenv,clazy-qstring-insensitive-allocation,clazy-fully-qualified-moc-types,clazy-unused-non-trivial-variable,clazy-connect-not-normalized,clazy-mutable-container-key,clazy-qenums,clazy-qmap-with-pointer-key,clazy-qstring-ref,clazy-strict-iterators,clazy-writing-to-temporary,clazy-container-anti-pattern,clazy-qcolor-from-literal,clazy-qfileinfo-exists,clazy-qstring-arg,clazy-empty-qstringliteral,clazy-qt-macros,clazy-temporary-iterator,clazy-wrong-qglobalstatic,clazy-lowercase-qml-type-name,clazy-no-module-include,clazy-use-static-qregularexpression` +`clazy-overloaded-signal,clazy-connect-by-name,clazy-connect-non-signal,clazy-qstring-comparison-to-implicit-char,clazy-wrong-qevent-cast,clazy-lambda-in-connect,clazy-lambda-unique-connection,clazy-qdatetime-utc,clazy-qgetenv,clazy-qstring-insensitive-allocation,clazy-fully-qualified-moc-types,clazy-unused-non-trivial-variable,clazy-connect-not-normalized,clazy-mutable-container-key,clazy-qenums,clazy-qmap-with-pointer-key,clazy-strict-iterators,clazy-writing-to-temporary,clazy-container-anti-pattern,clazy-qcolor-from-literal,clazy-qfileinfo-exists,clazy-qstring-arg,clazy-empty-qstringliteral,clazy-qt-macros,clazy-temporary-iterator,clazy-wrong-qglobalstatic,clazy-lowercase-qml-type-name,clazy-no-module-include,clazy-use-static-qregularexpression` To enable all checks from level1 use: `clazy-auto-unexpected-qstringbuilder,clazy-connect-3arg-lambda,clazy-const-signal-or-slot,clazy-detaching-temporary,clazy-foreach,clazy-incorrect-emit,clazy-install-event-filter,clazy-non-pod-global-static,clazy-post-event,clazy-qdeleteall,clazy-qlatin1string-non-ascii,clazy-qproperty-without-notify,clazy-qstring-left,clazy-range-loop-detach,clazy-range-loop-reference,clazy-returning-data-from-temporary,clazy-rule-of-two-soft,clazy-child-event-qobject-cast,clazy-virtual-signal,clazy-overridden-signal,clazy-qhash-namespace,clazy-skipped-base-method,clazy-readlock-detaching` To enable all checks from level2 use: diff --git a/checks.json b/checks.json index c21df7f1..d298a3ba 100644 --- a/checks.json +++ b/checks.json @@ -251,19 +251,6 @@ "visits_decls": true }, { - "name": "qstring-ref", - "class_name": "StringRefCandidates", - "level": 0, - "categories": ["performance", "qstring"], - "fixits": [ - { - "name": "missing-qstringref" - } - ], - "visits_stmts": true, - "can_ignore_includes": true - }, - { "name": "strict-iterators", "level": 0, "categories": ["containers", "performance", "bug"], diff --git a/docs/checks/README-qstring-ref.md b/docs/checks/README-qstring-ref.md deleted file mode 100644 index 98b77dd0..00000000 --- a/docs/checks/README-qstring-ref.md +++ /dev/null @@ -1,16 +0,0 @@ -# qstring-ref - -Finds places where `QString::fooRef()` should be used instead of `QString::foo()`, to avoid temporary heap allocations. - -#### Example - - str.mid(5).toInt(ok) // BAD - - str.midRef(5).toInt(ok) // GOOD - -Where `mid` can be any of: `mid`, `left`, `right`. -And `toInt()` can be any of: `compare`, `contains`, `count`, `startsWith`, `endsWith`, `indexOf`, `isEmpty`, `isNull`, `lastIndexOf`, `length`, `size`, `to*`, `trimmed` - -#### FixIts - -This check supports a fixit to rewrite your code. See the README.md on how to enable it. diff --git a/readmes.cmake b/readmes.cmake index 2c191a53..7008757d 100644 --- a/readmes.cmake +++ b/readmes.cmake @@ -50,7 +50,6 @@ SET(README_LEVEL0_FILES ${CMAKE_CURRENT_LIST_DIR}/docs/checks/README-qstring-arg.md ${CMAKE_CURRENT_LIST_DIR}/docs/checks/README-qstring-comparison-to-implicit-char.md ${CMAKE_CURRENT_LIST_DIR}/docs/checks/README-qstring-insensitive-allocation.md - ${CMAKE_CURRENT_LIST_DIR}/docs/checks/README-qstring-ref.md ${CMAKE_CURRENT_LIST_DIR}/docs/checks/README-qt-macros.md ${CMAKE_CURRENT_LIST_DIR}/docs/checks/README-strict-iterators.md ${CMAKE_CURRENT_LIST_DIR}/docs/checks/README-temporary-iterator.md diff --git a/src/Checks.h b/src/Checks.h index 07da15f0..c7a85413 100644 --- a/src/Checks.h +++ b/src/Checks.h @@ -29,7 +29,6 @@ #include "checks/level0/qstring-arg.h" #include "checks/level0/qstring-comparison-to-implicit-char.h" #include "checks/level0/qstring-insensitive-allocation.h" -#include "checks/level0/qstring-ref.h" #include "checks/level0/qt-macros.h" #include "checks/level0/strict-iterators.h" #include "checks/level0/temporary-iterator.h" @@ -173,8 +172,6 @@ void CheckManager::registerChecks() registerCheck(check<QStringArg>("qstring-arg", CheckLevel0, RegisteredCheck::Option_VisitsStmts, true)); registerCheck(check<QStringComparisonToImplicitChar>("qstring-comparison-to-implicit-char", CheckLevel0, RegisteredCheck::Option_VisitsStmts, false)); registerCheck(check<QStringInsensitiveAllocation>("qstring-insensitive-allocation", CheckLevel0, RegisteredCheck::Option_VisitsStmts, true)); - registerCheck(check<StringRefCandidates>("qstring-ref", CheckLevel0, RegisteredCheck::Option_VisitsStmts, true)); - registerFixIt(1, "fix-missing-qstringref", "qstring-ref"); registerCheck(check<QtMacros>("qt-macros", CheckLevel0, RegisteredCheck::Option_PreprocessorCallbacks, false)); registerCheck(check<StrictIterators>("strict-iterators", CheckLevel0, RegisteredCheck::Option_VisitsStmts, true)); registerCheck(check<TemporaryIterator>("temporary-iterator", CheckLevel0, RegisteredCheck::Option_VisitsStmts, false)); diff --git a/src/checks/level0/qstring-ref.cpp b/src/checks/level0/qstring-ref.cpp deleted file mode 100644 index 3d98f970..00000000 --- a/src/checks/level0/qstring-ref.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - SPDX-FileCopyrightText: 2015 Sergio Martins <smartins@kde.org> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include "qstring-ref.h" -#include "ClazyContext.h" -#include "FixItUtils.h" -#include "HierarchyUtils.h" -#include "StringUtils.h" -#include "Utils.h" -#include "clazy_stl.h" - -#include <clang/AST/DeclCXX.h> -#include <clang/AST/Expr.h> -#include <clang/AST/ExprCXX.h> -#include <clang/AST/Stmt.h> -#include <clang/Basic/IdentifierTable.h> -#include <clang/Basic/LLVM.h> -#include <clang/Basic/SourceLocation.h> -#include <clang/Lex/Lexer.h> -#include <llvm/ADT/SmallVector.h> -#include <llvm/ADT/StringRef.h> -#include <llvm/Support/Casting.h> - -#include <vector> - -using namespace clang; - -static bool isInterestingFirstMethod(CXXMethodDecl *method) -{ - if (!method || clazy::name(method->getParent()) != "QString") { - return false; - } - - static const std::vector<StringRef> list{"left", "mid", "right"}; - return clazy::contains(list, clazy::name(method)); -} - -static bool isInterestingSecondMethod(CXXMethodDecl *method, const clang::LangOptions &lo) -{ - if (!method || clazy::name(method->getParent()) != "QString") { - return false; - } - - static const std::vector<StringRef> list{ - "compare", "contains", "count", "startsWith", "endsWith", "indexOf", "isEmpty", "isNull", "lastIndexOf", "length", - "size", "toDouble", "toFloat", "toInt", "toUInt", "toULong", "toULongLong", "toUShort", "toUcs4", - }; - - if (!clazy::contains(list, clazy::name(method))) { - return false; - } - - return !clazy::anyArgIsOfAnySimpleType(method, {"QRegExp", "QRegularExpression"}, lo); -} - -static bool isMethodReceivingQStringRef(CXXMethodDecl *method) -{ - if (!method || clazy::name(method->getParent()) != "QString") { - return false; - } - - static const std::vector<StringRef> list{"append", "compare", "count", "indexOf", "endsWith", "lastIndexOf", "localAwareCompare", "startsWidth"}; - - if (clazy::contains(list, clazy::name(method))) { - return true; - } - - if (method->getOverloadedOperator() == OO_PlusEqual) { // operator+= - return true; - } - - return false; -} - -void StringRefCandidates::VisitStmt(clang::Stmt *stmt) -{ - // Here we look for code like str.firstMethod().secondMethod(), where firstMethod() is for example mid() and secondMethod is for example, toInt() - - auto *call = dyn_cast<CallExpr>(stmt); - if (!call || processCase1(dyn_cast<CXXMemberCallExpr>(call))) { - return; - } - - processCase2(call); -} - -static bool containsChild(Stmt *s, Stmt *target) -{ - if (!s) { - return false; - } - - if (s == target) { - return true; - } - - if (auto *mte = dyn_cast<MaterializeTemporaryExpr>(s)) { - return containsChild(mte->getSubExpr(), target); - } else if (auto *ice = dyn_cast<ImplicitCastExpr>(s)) { - return containsChild(ice->getSubExpr(), target); - } else if (auto *bte = dyn_cast<CXXBindTemporaryExpr>(s)) { - return containsChild(bte->getSubExpr(), target); - } - - return false; -} - -bool StringRefCandidates::isConvertedToSomethingElse(clang::Stmt *s) const -{ - // While passing a QString to the QVariant ctor works fine, passing QStringRef doesn't - // So let's not warn when QStrings are cast to something else. - if (!s) { - return false; - } - - auto *constr = clazy::getFirstParentOfType<CXXConstructExpr>(m_context->parentMap, s); - if (!constr || constr->getNumArgs() == 0) { - return false; - } - - if (containsChild(constr->getArg(0), s)) { - CXXConstructorDecl *ctor = constr->getConstructor(); - CXXRecordDecl *record = ctor ? ctor->getParent() : nullptr; - return record ? record->getQualifiedNameAsString() != "QString" : false; - } - - return false; -} - -// Catches cases like: int i = s.mid(1, 1).toInt() -bool StringRefCandidates::processCase1(CXXMemberCallExpr *memberCall) -{ - if (!memberCall) { - return false; - } - - // In the AST secondMethod() is parent of firstMethod() call, and will be visited first (because at runtime firstMethod() is resolved first(). - // So check for interesting second method first - CXXMethodDecl *method = memberCall->getMethodDecl(); - if (!isInterestingSecondMethod(method, lo())) { - return false; - } - - std::vector<CallExpr *> callExprs = Utils::callListForChain(memberCall); - if (callExprs.size() < 2) { - return false; - } - - // The list now contains {secondMethod(), firstMethod() } - auto *firstMemberCall = dyn_cast<CXXMemberCallExpr>(callExprs.at(1)); - - if (!firstMemberCall || !isInterestingFirstMethod(firstMemberCall->getMethodDecl())) { - return false; - } - - if (isConvertedToSomethingElse(memberCall)) { - return false; - } - - const std::string firstMethodName = firstMemberCall->getMethodDecl()->getNameAsString(); - const std::vector<FixItHint> fixits = fixit(firstMemberCall); - - emitWarning(firstMemberCall->getEndLoc(), "Use " + firstMethodName + "Ref() instead", fixits); - return true; -} - -// Catches cases like: s.append(s2.mid(1, 1)); -bool StringRefCandidates::processCase2(CallExpr *call) -{ - auto *memberCall = dyn_cast<CXXMemberCallExpr>(call); - auto *operatorCall = memberCall ? nullptr : dyn_cast<CXXOperatorCallExpr>(call); - - CXXMethodDecl *method = nullptr; - if (memberCall) { - method = memberCall->getMethodDecl(); - } else if (operatorCall && operatorCall->getCalleeDecl()) { - Decl *decl = operatorCall->getCalleeDecl(); - method = dyn_cast<CXXMethodDecl>(decl); - } - - if (!isMethodReceivingQStringRef(method)) { - return false; - } - - Expr *firstArgument = call->getNumArgs() > 0 ? call->getArg(0) : nullptr; - MaterializeTemporaryExpr *temp = firstArgument ? dyn_cast<MaterializeTemporaryExpr>(firstArgument) : nullptr; - if (!temp) { - Expr *secondArgument = call->getNumArgs() > 1 ? call->getArg(1) : nullptr; - temp = secondArgument ? dyn_cast<MaterializeTemporaryExpr>(secondArgument) : nullptr; - if (!temp) { // For the CXXOperatorCallExpr it's in the second argument - return false; - } - } - - auto *innerCall = clazy::getFirstChildOfType2<CallExpr>(temp); - auto *innerMemberCall = innerCall ? dyn_cast<CXXMemberCallExpr>(innerCall) : nullptr; - if (!innerMemberCall) { - return false; - } - - CXXMethodDecl *innerMethod = innerMemberCall->getMethodDecl(); - if (!isInterestingFirstMethod(innerMethod)) { - return false; - } - - const std::vector<FixItHint> fixits = fixit(innerMemberCall); - - emitWarning(call->getSourceRange().getBegin(), "Use " + innerMethod->getNameAsString() + "Ref() instead", fixits); - return true; -} - -std::vector<FixItHint> StringRefCandidates::fixit(CXXMemberCallExpr *call) -{ - auto *memberExpr = clazy::getFirstChildOfType<MemberExpr>(call); - if (!memberExpr) { - return {}; - } - - auto insertionLoc = Lexer::getLocForEndOfToken(memberExpr->getEndLoc(), 0, sm(), lo()); - if (!insertionLoc.isValid()) { - return {}; - } - - std::vector<FixItHint> fixits; - fixits.push_back(clazy::createInsertion(insertionLoc, "Ref")); - return fixits; -} diff --git a/src/checks/level0/qstring-ref.h b/src/checks/level0/qstring-ref.h deleted file mode 100644 index aa48871d..00000000 --- a/src/checks/level0/qstring-ref.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - SPDX-FileCopyrightText: 2015 Sergio Martins <smartins@kde.org> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#ifndef QSTRING_REF_H -#define QSTRING_REF_H - -#include "checkbase.h" - -#include <clang/Basic/Diagnostic.h> -#include <vector> - -namespace clang -{ -class CallExpr; -class CXXMemberCallExpr; -} - -/** - * Finds places where the QString::fooRef() should be used instead QString::foo(), to save allocations - * - * See README-qstringref for more info. - */ -class StringRefCandidates : public CheckBase -{ -public: - using CheckBase::CheckBase; - void VisitStmt(clang::Stmt *stmt) override; - -private: - bool processCase1(clang::CXXMemberCallExpr *); - bool processCase2(clang::CallExpr *call); - bool isConvertedToSomethingElse(clang::Stmt *s) const; - - std::vector<clang::CallExpr *> m_alreadyProcessedChainedCalls; - std::vector<clang::FixItHint> fixit(clang::CXXMemberCallExpr *); -}; - -#endif diff --git a/tests/clazy/test_requested_checks.sh.expected b/tests/clazy/test_requested_checks.sh.expected index 15ea8070..51558fb2 100644 --- a/tests/clazy/test_requested_checks.sh.expected +++ b/tests/clazy/test_requested_checks.sh.expected @@ -1,6 +1,6 @@ -Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic Invalid check: foo -Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic Requested checks: foreach Requested checks: foreach, writing-to-temporary Invalid check: foo @@ -8,20 +8,20 @@ Requested checks: foreach, writing-to-temporary Requested checks: old-style-connect Requested checks: old-style-connect Requested checks: foreach, old-style-connect -Requested checks: auto-unexpected-qstringbuilder, base-class-event, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, copyable-polymorphic, ctor-missing-parent-argument, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, function-args-by-ref, function-args-by-value, global-const-char-pointer, implicit-casts, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, missing-qobject-macro, missing-typeinfo, mutable-container-key, non-pod-global-static, old-style-connect, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-allocations, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, returning-void-expression, rule-of-three, rule-of-two-soft, skipped-base-method, static-pmf, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-call-ctor, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, base-class-event, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, copyable-polymorphic, ctor-missing-parent-argument, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, function-args-by-ref, function-args-by-value, global-const-char-pointer, implicit-casts, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, missing-qobject-macro, missing-typeinfo, mutable-container-key, non-pod-global-static, old-style-connect, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-allocations, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, returning-void-expression, rule-of-three, rule-of-two-soft, skipped-base-method, static-pmf, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-call-ctor, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic Requested checks: implicit-casts Requested checks: foreach, implicit-casts Requested checks: old-style-connect -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, reserve-candidates, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, foreach, fully-qualified-moc-types, implicit-casts, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, reserve-candidates, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, foreach, fully-qualified-moc-types, implicit-casts, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic Test9 -Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, reserve-candidates, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, implicit-casts, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, reserve-candidates, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, reserve-candidates, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, implicit-casts, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qenums, qfileinfo-exists, qgetenv, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, reserve-candidates, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic Requested checks: implicit-casts Requested checks: implicit-casts Could not find checks in comma separated string implicit-casts,no-implicit-casts @@ -45,7 +45,6 @@ Available checks and FixIts: - qmap-with-pointer-key - qstring-arg - qstring-insensitive-allocation - - qstring-ref (fix-missing-qstringref) - qt-macros - qvariant-template-instantiation - strict-iterators @@ -116,9 +115,9 @@ or pass as compiler arguments, for example: FixIts are experimental and rewrite your code therefore only one FixIt is allowed per build. Specifying a list of different FixIts is not supported. Backup your code before running them. -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qfileinfo-exists, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qfileinfo-exists, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic Requested checks: implicit-casts Requested checks: implicit-casts -Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qfileinfo-exists, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qstring-ref, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic -Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qstring-ref, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qenums, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: connect-by-name, connect-non-signal, connect-not-normalized, container-anti-pattern, empty-qstringliteral, fully-qualified-moc-types, lambda-in-connect, lambda-unique-connection, mutable-container-key, qcolor-from-literal, qdatetime-utc, qfileinfo-exists, qmap-with-pointer-key, qstring-arg, qstring-insensitive-allocation, qt-macros, qvariant-template-instantiation, strict-iterators, temporary-iterator, unused-non-trivial-variable, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic +Requested checks: auto-unexpected-qstringbuilder, child-event-qobject-cast, connect-3arg-lambda, connect-by-name, connect-non-signal, connect-not-normalized, const-signal-or-slot, container-anti-pattern, detaching-temporary, empty-qstringliteral, foreach, fully-qualified-moc-types, incorrect-emit, inefficient-qlist-soft, install-event-filter, lambda-in-connect, lambda-unique-connection, mutable-container-key, non-pod-global-static, overridden-signal, post-event, qcolor-from-literal, qdatetime-utc, qdeleteall, qfileinfo-exists, qgetenv, qhash-namespace, qlatin1string-non-ascii, qmap-with-pointer-key, qproperty-without-notify, qstring-arg, qstring-insensitive-allocation, qstring-left, qt-macros, qvariant-template-instantiation, range-loop, returning-data-from-temporary, rule-of-two-soft, skipped-base-method, strict-iterators, temporary-iterator, unused-non-trivial-variable, virtual-signal, writing-to-temporary, wrong-qevent-cast, wrong-qglobalstatic diff --git a/tests/qstring-ref/bug376737.cpp b/tests/qstring-ref/bug376737.cpp deleted file mode 100644 index 7d0575ed..00000000 --- a/tests/qstring-ref/bug376737.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include <QtCore/QString> -#include <QtCore/QObject> -#include <QtCore/QVariant> - -void test() -{ - QString line; - QObject o; - o.setProperty("size", line.mid(7).trimmed()); // OK - QString attributes = line.mid(13).trimmed(); // OK - - QString comment; - if (!comment.trimmed().isEmpty()) { // OK - } -} diff --git a/tests/qstring-ref/bug376737.cpp.expected b/tests/qstring-ref/bug376737.cpp.expected deleted file mode 100644 index e69de29b..00000000 --- a/tests/qstring-ref/bug376737.cpp.expected +++ /dev/null diff --git a/tests/qstring-ref/config.json b/tests/qstring-ref/config.json deleted file mode 100644 index f530932f..00000000 --- a/tests/qstring-ref/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "tests": [ - { - "filename": "main.cpp", - "qt_major_versions": [5] - }, - { - "filename": "bug376737.cpp", - "qt_major_versions": [5] - } - ] -} diff --git a/tests/qstring-ref/main.cpp b/tests/qstring-ref/main.cpp deleted file mode 100644 index 189ed53c..00000000 --- a/tests/qstring-ref/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include <QtCore/QString> -#include <QtCore/QRegExp> -#include <QtCore/QStringList> -void test() -{ - bool ok = false; - QString s; - s.mid(1, 1).toInt(&ok); // Warning - s.mid(1, 1); // OK - s.toInt(&ok); // OK - s.midRef(1, 1).toInt(&ok); // OK - s.mid(s.lastIndexOf(QLatin1Char('#')) + 1).toUpper(); // OK - s.mid(s.lastIndexOf(QLatin1Char('#')) + 1).trimmed(); // Warning - const QRegExp r; - QRegExp r2; - s.mid(1, 1).indexOf(r); // OK - s.mid(1, 1).indexOf(r2); // OK - QString s2; - s.append(s2.mid(1,1)); // Warning - s.count(s2.left(1)); // Warning - QStringList list; - list.append(s2.mid(1,1)); // OK - s += s2.mid(1,1); // Warning - int start,end; - int m = s.mid(start + 1, end - start - 1).toUInt(&ok); // Warning -} - -QString i18n(const QString &) { return {}; } - -void test2() -{ - QString s; - s.append(i18n(s.mid(1, 1))); // OK -} diff --git a/tests/qstring-ref/main.cpp.expected b/tests/qstring-ref/main.cpp.expected deleted file mode 100644 index e050d74d..00000000 --- a/tests/qstring-ref/main.cpp.expected +++ /dev/null @@ -1,5 +0,0 @@ -qstring-ref/main.cpp:8:15: warning: Use midRef() instead [-Wclazy-qstring-ref] -qstring-ref/main.cpp:19:5: warning: Use midRef() instead [-Wclazy-qstring-ref] -qstring-ref/main.cpp:20:5: warning: Use leftRef() instead [-Wclazy-qstring-ref] -qstring-ref/main.cpp:23:5: warning: Use midRef() instead [-Wclazy-qstring-ref] -qstring-ref/main.cpp:25:45: warning: Use midRef() instead [-Wclazy-qstring-ref] |
