diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/checkers/readability')
9 files changed, 29 insertions, 28 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/braces-around-statements.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/braces-around-statements.cpp index b74c4cb..f1bb4ed 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/braces-around-statements.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/braces-around-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes %s readability-braces-around-statements %t +// RUN: %check_clang_tidy %s readability-braces-around-statements %t void do_something(const char *) {} @@ -77,9 +77,6 @@ void test() { // CHECK-FIXES-NEXT: do_something("for"); // CHECK-FIXES-NEXT: } - for (;;) { - do_something("for-ok"); - } for (;;) ; // CHECK-MESSAGES: :[[@LINE-2]]:11: warning: statement should be inside braces @@ -87,6 +84,10 @@ void test() { // CHECK-FIXES-NEXT: ; // CHECK-FIXES-NEXT: } + for (;;) { + do_something("for-ok"); + } + int arr[4] = {1, 2, 3, 4}; for (int a : arr) do_something("for-range"); @@ -378,7 +379,7 @@ int test_macros(bool b) { #define WRAP(X) { X; } // This is to ensure no other CHECK-FIXES matches the macro definition: - // CHECK-FIXES: WRAP + // CHECK-FIXES: #define WRAP(X) { X; } // Use-case: LLVM_DEBUG({ for(...) do_something(); }); WRAP({ diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp index 43a7ddb..d78ea34 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes -std=c++14-or-later %s readability-const-return-type %t -- -- -Wno-error=return-type +// RUN: %check_clang_tidy -std=c++14-or-later %s readability-const-return-type %t -- -- -Wno-error=return-type // p# = positive test // n# = negative test @@ -66,7 +66,7 @@ class Clazz { const Klazz<const int>* const p5() const; // CHECK-FIXES: const Klazz<const int>* p5() const; - const Clazz operator++(int x) { // p12 + const Clazz operator++(int x) { // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Clazz' is 'const // CHECK-FIXES: Clazz operator++(int x) { } diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp index 8950c72..7844275 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes -std=c++14-or-later %s readability-container-size-empty %t -- \ +// RUN: %check_clang_tidy -std=c++14-or-later %s readability-container-size-empty %t -- \ // RUN: -config="{CheckOptions: {readability-container-size-empty.ExcludedComparisonTypes: '::std::array;::IgnoredDummyType'}}" \ // RUN: -- -fno-delayed-template-parsing -isystem %clang_tidy_headers #include <string> @@ -807,7 +807,7 @@ bool testStringLiterals(const std::string& s) using namespace std::string_literals; return s == ""s; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: the 'empty' method should be used - // CHECK-FIXES: return s.empty() + // CHECK-FIXES: return s.empty(); } bool testNotEmptyStringLiterals(const std::string& s) @@ -951,7 +951,7 @@ public: void doit() { if (!size()) { // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: the 'empty' method should be used to check for emptiness instead of 'size' - // CHECK-FIXES: if (empty()) + // CHECK-FIXES: if (empty()) { } } }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c index 5a4627a..7f82b95 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy -std=c23-or-later --match-partial-fixes %s readability-implicit-bool-conversion %t +// RUN: %check_clang_tidy -std=c23-or-later %s readability-implicit-bool-conversion %t // RUN: %check_clang_tidy -std=c23-or-later -check-suffix=UPPER-CASE %s readability-implicit-bool-conversion %t -- \ // RUN: -config='{CheckOptions: { \ // RUN: readability-implicit-bool-conversion.UseUpperCaseLiteralSuffix: true \ @@ -341,28 +341,28 @@ int implicitConversionReturnInt() { return true; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'bool' -> 'int' - // CHECK-FIXES: return 1 + // CHECK-FIXES: return 1; } int implicitConversionReturnIntWithParens() { return (true); // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'bool' -> 'int' - // CHECK-FIXES: return 1 + // CHECK-FIXES: return 1; } bool implicitConversionReturnBool() { return 1; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'int' -> 'bool' - // CHECK-FIXES: return true + // CHECK-FIXES: return true; } bool implicitConversionReturnBoolWithParens() { return (1); // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'int' -> 'bool' - // CHECK-FIXES: return true + // CHECK-FIXES: return true; } int keepCompactReturnInC_PR71848() { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp index a0e1fd3..c3faf8a 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes %s readability-implicit-bool-conversion %t +// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t // RUN: %check_clang_tidy -check-suffix=UPPER-CASE %s readability-implicit-bool-conversion %t -- \ // RUN: -config='{CheckOptions: { \ // RUN: readability-implicit-bool-conversion.UseUpperCaseLiteralSuffix: true \ @@ -490,14 +490,14 @@ int implicitConversionReturnInt() { return true; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'bool' -> 'int' - // CHECK-FIXES: return 1 + // CHECK-FIXES: return 1; } int implicitConversionReturnIntWithParens() { return (true); // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'bool' -> 'int' - // CHECK-FIXES: return 1 + // CHECK-FIXES: return 1; } @@ -505,14 +505,14 @@ bool implicitConversionReturnBool() { return 1; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'int' -> 'bool' - // CHECK-FIXES: return true + // CHECK-FIXES: return true; } bool implicitConversionReturnBoolWithParens() { return (1); // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'int' -> 'bool' - // CHECK-FIXES: return true + // CHECK-FIXES: return true; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/math-missing-parentheses.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/math-missing-parentheses.cpp index 947eda0..b9f9226 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/math-missing-parentheses.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/math-missing-parentheses.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes %s readability-math-missing-parentheses %t +// RUN: %check_clang_tidy %s readability-math-missing-parentheses %t #define MACRO_AND & #define MACRO_ADD + @@ -123,7 +123,7 @@ void f(){ //CHECK-MESSAGES: :[[@LINE+3]]:77: warning: '-' has higher precedence than '^'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses] //CHECK-MESSAGES: :[[@LINE+2]]:94: warning: '/' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses] //CHECK-FIXES: int q = (1 MACRO_ADD (2 MACRO_MULTIPLY 3)) MACRO_OR ((4 MACRO_AND 5) MACRO_XOR (6 MACRO_SUBTRACT (7 MACRO_DIVIDE 8))); - int q = 1 MACRO_ADD 2 MACRO_MULTIPLY 3 MACRO_OR 4 MACRO_AND 5 MACRO_XOR 6 MACRO_SUBTRACT 7 MACRO_DIVIDE 8; // No warning + int q = 1 MACRO_ADD 2 MACRO_MULTIPLY 3 MACRO_OR 4 MACRO_AND 5 MACRO_XOR 6 MACRO_SUBTRACT 7 MACRO_DIVIDE 8; //CHECK-MESSAGES: :[[@LINE+1]]:21: warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses] int r = FUN(0 + 1 * 2); diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-members.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-members.cpp index 83f2fa9..89208fb 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-members.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-members.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes %s readability-simplify-boolean-expr %t +// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t class A { public: @@ -353,4 +353,4 @@ bool S::expr_with_cleanups() { return true; } // CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return -// CHECK-FIXES: m_ar == (A)m_ar; +// CHECK-FIXES: return m_ar == (A)m_ar; diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr.cpp index ee5ff7b..0b99cb8 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes %s readability-simplify-boolean-expr %t +// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t bool a1 = false; @@ -1019,7 +1019,7 @@ bool expr_with_cleanups(A &S) { return true; } // CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return -// CHECK-FIXES: S == (A)S;{{$}} +// CHECK-FIXES: return S == (A)S;{{$}} template <bool B> void ignoreInstantiations() { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-integer-custom-list.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-integer-custom-list.cpp index a4fcf3a..399afa5 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-integer-custom-list.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-integer-custom-list.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes %s readability-uppercase-literal-suffix %t -- -config="{CheckOptions: {readability-uppercase-literal-suffix.NewSuffixes: 'L;uL'}}" -- -I %clang_tidy_headers +// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -config="{CheckOptions: {readability-uppercase-literal-suffix.NewSuffixes: 'L;uL'}}" -- -I %clang_tidy_headers #include "integral_constant.h" @@ -53,7 +53,7 @@ void integer_suffix() { static_assert(is_same<decltype(v11), const unsigned long>::value, ""); static_assert(v11 == 1, ""); - static constexpr auto v12 = 1UL; // OK. + static constexpr auto v12 = 1UL; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'UL', which is not uppercase // CHECK-FIXES: static constexpr auto v12 = 1uL; static_assert(is_same<decltype(v12), const unsigned long>::value, ""); |