From 05ab6b7029d97d247ca306f166d7d28695458676 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Tue, 7 Oct 2025 04:55:23 -0700 Subject: [PATCH 1/4] [clang-tidy][NFC] Remove regex hacks to match full lines in tests --- .../checkers/abseil/cleanup-ctad.cpp | 12 +- .../checkers/abseil/str-cat-append.cpp | 6 +- .../abseil/string-find-str-contains.cpp | 72 +- .../checkers/bugprone/argument-comment.cpp | 2 +- .../easily-swappable-parameters-implicits.c | 14 +- .../easily-swappable-parameters-implicits.cpp | 10 +- .../checkers/bugprone/inaccurate-erase.cpp | 16 +- .../misplaced-operator-in-strlen-in-alloc.cpp | 6 +- .../bugprone/reserved-identifier-invert.cpp | 12 +- .../bugprone/string-integer-assignment.cpp | 20 +- .../checkers/bugprone/stringview-nullptr.cpp | 628 +++++++++--------- .../bugprone/suspicious-semicolon.cpp | 10 +- .../cppcoreguidelines/init-variables.cpp | 26 +- .../google/readability-namespace-comments.cpp | 4 +- .../misc/include-cleaner-wrong-config.cpp | 2 +- .../checkers/misc/include-cleaner.cpp | 4 +- .../checkers/misc/redundant-expression.cpp | 10 +- .../misc/unused-parameters-strict.cpp | 6 +- .../checkers/misc/unused-parameters.c | 4 +- .../checkers/misc/unused-parameters.cpp | 58 +- .../misc/unused-using-decls-cxx17.cpp | 2 +- .../modernize/deprecated-headers-cxx03.cpp | 84 +-- .../modernize/deprecated-headers-cxx11.cpp | 104 +-- .../checkers/modernize/raw-string-literal.cpp | 32 +- .../modernize/redundant-void-arg-delayed.cpp | 6 +- .../checkers/modernize/redundant-void-arg.cpp | 80 +-- ...replace-disallow-copy-and-assign-macro.cpp | 12 +- .../checkers/modernize/use-bool-literals.cpp | 54 +- .../use-constraints-first-greatergreater.cpp | 2 +- .../checkers/modernize/use-constraints.cpp | 254 ++++--- .../use-default-member-init-assignment.cpp | 16 +- .../modernize/use-default-member-init.cpp | 20 +- .../modernize/use-equals-default-copy.cpp | 2 +- .../checkers/modernize/use-equals-default.cpp | 12 +- .../use-override-allow-override-and-final.cpp | 12 +- .../checkers/modernize/use-override-ms.cpp | 4 +- .../modernize/use-override-no-destructors.cpp | 2 +- .../modernize/use-override-templates.cpp | 2 +- .../modernize/use-override-with-macro.cpp | 20 +- .../use-override-with-no-macro-inscope.cpp | 6 +- .../checkers/modernize/use-override.cpp | 108 +-- .../use-trailing-return-type-cxx20.cpp | 18 +- ...ng-return-type-transform-lambdas-cxx14.cpp | 6 +- ...ng-return-type-transform-lambdas-cxx20.cpp | 14 +- ...trailing-return-type-transform-lambdas.cpp | 24 +- .../modernize/use-trailing-return-type.cpp | 244 +++---- .../readability/container-data-pointer.cpp | 22 +- .../container-size-empty-cxx20.cpp | 4 +- .../readability/container-size-empty.cpp | 214 +++--- .../convert-member-functions-to-static.cpp | 22 +- .../function-cognitive-complexity.cpp | 436 ++++++------ .../identifier-naming-anon-record-fields.cpp | 54 +- ...dentifier-naming-bugfix-name-conflicts.cpp | 12 +- .../identifier-naming-case-match.cpp | 18 +- ...ier-naming-hungarian-notation-c-language.c | 250 +++---- ...fier-naming-hungarian-notation-cfgfile.cpp | 302 ++++----- .../identifier-naming-hungarian-notation.cpp | 302 ++++----- .../identifier-naming-ignored-regexp.cpp | 12 +- .../identifier-naming-member-decl-usage.cpp | 62 +- .../readability/identifier-naming.cpp | 296 ++++----- ...tent-declaration-parameter-name-macros.cpp | 2 +- .../isolate-declaration-fixing.cpp | 18 +- .../readability/isolate-declaration.cpp | 158 ++--- .../make-member-function-const.cpp | 36 +- .../readability/non-const-parameter.c | 2 +- .../readability/non-const-parameter.cpp | 36 +- ...perators-representation-to-alternative.cpp | 66 +- ...perators-representation-to-traditional.cpp | 66 +- .../readability/qualified-auto-cxx20.cpp | 12 +- .../checkers/readability/qualified-auto.cpp | 124 ++-- ...ess-specifiers-check-first-declaration.cpp | 6 +- .../redundant-access-specifiers.cpp | 12 +- .../readability/redundant-casting.cpp | 40 +- .../readability/redundant-control-flow.cpp | 24 +- .../readability/redundant-declaration.c | 8 +- .../readability/redundant-declaration.cpp | 22 +- .../readability/redundant-member-init.cpp | 2 +- .../redundant-string-cstr-format.cpp | 24 +- .../redundant-string-cstr-function.cpp | 20 +- .../redundant-string-cstr-msvc.cpp | 12 +- .../readability/redundant-string-cstr.cpp | 74 +-- ...an-expr-chained-conditional-assignment.cpp | 12 +- ...oolean-expr-chained-conditional-return.cpp | 56 +- .../simplify-boolean-expr-members.cpp | 62 +- ...sed-through-instance-nesting-threshold.cpp | 6 +- .../static-accessed-through-instance.cpp | 66 +- ...atic-definition-in-anonymous-namespace.cpp | 22 +- .../readability/uniqueptr-delete-release.cpp | 36 +- 88 files changed, 2545 insertions(+), 2547 deletions(-) diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/cleanup-ctad.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil/cleanup-ctad.cpp index c2b5e4df985d8..53400ac04d3b5 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/abseil/cleanup-ctad.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/cleanup-ctad.cpp @@ -79,27 +79,27 @@ absl::Cleanup MakeCleanup(Callback callback) { void test() { auto a = absl::MakeCleanup([] {}); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer absl::Cleanup's class template argument deduction pattern in C++17 and higher - // CHECK-FIXES: {{^}} absl::Cleanup a = [] {};{{$}} + // CHECK-FIXES: absl::Cleanup a = [] {}; auto b = absl::MakeCleanup(std::function([] {})); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer absl::Cleanup{{.*}}C++17 and higher - // CHECK-FIXES: {{^}} absl::Cleanup b = std::function([] {});{{$}} + // CHECK-FIXES: absl::Cleanup b = std::function([] {}); const auto c = absl::MakeCleanup([] {}); // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: prefer absl::Cleanup{{.*}}C++17 and higher - // CHECK-FIXES: {{^}} const absl::Cleanup c = [] {};{{$}} + // CHECK-FIXES: const absl::Cleanup c = [] {}; const auto d = absl::MakeCleanup(std::function([] {})); // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: prefer absl::Cleanup{{.*}}C++17 and higher - // CHECK-FIXES: {{^}} const absl::Cleanup d = std::function([] {});{{$}} + // CHECK-FIXES: const absl::Cleanup d = std::function([] {}); // Preserves extra parens auto e = absl::MakeCleanup(([] {})); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer absl::Cleanup{{.*}}C++17 and higher - // CHECK-FIXES: {{^}} absl::Cleanup e = ([] {});{{$}} + // CHECK-FIXES: absl::Cleanup e = ([] {}); // Preserves comments auto f = /* a */ absl::MakeCleanup(/* b */ [] { /* c */ } /* d */) /* e */; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer absl::Cleanup{{.*}}C++17 and higher - // CHECK-FIXES: {{^}} absl::Cleanup f = /* a */ /* b */ [] { /* c */ } /* d */ /* e */;{{$}} + // CHECK-FIXES: absl::Cleanup f = /* a */ /* b */ [] { /* c */ } /* d */ /* e */; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/str-cat-append.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil/str-cat-append.cpp index 9a2585da5b277..90936fbb12a1f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/abseil/str-cat-append.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/str-cat-append.cpp @@ -97,7 +97,7 @@ void Bar() { // CHECK-MESSAGES: [[@LINE-1]]:3: warning: call to 'absl::StrCat' has no effect A = StrCat(A, B); // CHECK-MESSAGES: [[@LINE-1]]:3: warning: call 'absl::StrAppend' instead of 'absl::StrCat' when appending to a string to avoid a performance penalty -// CHECK-FIXES: {{^}} absl::StrAppend(&A, B); +// CHECK-FIXES: absl::StrAppend(&A, B); B = StrCat(A, B); #define M(X) X = StrCat(X, A) @@ -117,7 +117,7 @@ void OutsideAbsl() { std::string A, B; A = absl::StrCat(A, B); // CHECK-MESSAGES: [[@LINE-1]]:3: warning: call 'absl::StrAppend' instead of 'absl::StrCat' when appending to a string to avoid a performance penalty -// CHECK-FIXES: {{^}} absl::StrAppend(&A, B); +// CHECK-FIXES: absl::StrAppend(&A, B); } void OutsideUsingAbsl() { @@ -125,5 +125,5 @@ void OutsideUsingAbsl() { using absl::StrCat; A = StrCat(A, B); // CHECK-MESSAGES: [[@LINE-1]]:3: warning: call 'absl::StrAppend' instead of 'absl::StrCat' when appending to a string to avoid a performance penalty -// CHECK-FIXES: {{^}} absl::StrAppend(&A, B); +// CHECK-FIXES: absl::StrAppend(&A, B); } diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-str-contains.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-str-contains.cpp index bb9ba9918a1ba..c5d1f178e48b0 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-str-contains.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-str-contains.cpp @@ -70,41 +70,41 @@ void basic_tests() { std::string ss; ss.find("a") == std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of find() == npos - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ss, "a");{{$}} + // CHECK-FIXES: !absl::StrContains(ss, "a"); ss.find("a") != std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of find() != npos - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ss, "a");{{$}} + // CHECK-FIXES: absl::StrContains(ss, "a"); std::string::npos != ss.find("a"); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ss, "a");{{$}} + // CHECK-FIXES: absl::StrContains(ss, "a"); std::string_view ssv; ssv.find("a") == std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ssv, "a");{{$}} + // CHECK-FIXES: !absl::StrContains(ssv, "a"); ssv.find("a") != std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ssv, "a");{{$}} + // CHECK-FIXES: absl::StrContains(ssv, "a"); std::string_view::npos != ssv.find("a"); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ssv, "a");{{$}} + // CHECK-FIXES: absl::StrContains(ssv, "a"); absl::string_view asv; asv.find("a") == absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(asv, "a");{{$}} + // CHECK-FIXES: !absl::StrContains(asv, "a"); asv.find("a") != absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(asv, "a");{{$}} + // CHECK-FIXES: absl::StrContains(asv, "a"); absl::string_view::npos != asv.find("a"); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(asv, "a");{{$}} + // CHECK-FIXES: absl::StrContains(asv, "a"); } // Confirms that it works even if you mix-and-match the type for find and for @@ -115,29 +115,29 @@ void mismatched_npos() { std::string ss; ss.find("a") == std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ss, "a");{{$}} + // CHECK-FIXES: !absl::StrContains(ss, "a"); ss.find("a") != absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ss, "a");{{$}} + // CHECK-FIXES: absl::StrContains(ss, "a"); std::string_view ssv; ssv.find("a") == absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ssv, "a");{{$}} + // CHECK-FIXES: !absl::StrContains(ssv, "a"); ssv.find("a") != std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ssv, "a");{{$}} + // CHECK-FIXES: absl::StrContains(ssv, "a"); absl::string_view asv; asv.find("a") == std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(asv, "a");{{$}} + // CHECK-FIXES: !absl::StrContains(asv, "a"); asv.find("a") != std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(asv, "a");{{$}} + // CHECK-FIXES: absl::StrContains(asv, "a"); } // Confirms that it works even when the needle or the haystack are more @@ -146,41 +146,41 @@ void subexpression_tests() { std::string ss, ss2; foo_ss(ss).find(ss2) == std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(foo_ss(ss), ss2);{{$}} + // CHECK-FIXES: !absl::StrContains(foo_ss(ss), ss2); ss.find(foo_ss(ss2)) != std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ss, foo_ss(ss2));{{$}} + // CHECK-FIXES: absl::StrContains(ss, foo_ss(ss2)); foo_ss(bar_ss()).find(foo_ss(ss2)) != std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(foo_ss(bar_ss()), foo_ss(ss2));{{$}} + // CHECK-FIXES: absl::StrContains(foo_ss(bar_ss()), foo_ss(ss2)); std::string_view ssv, ssv2; foo_ssv(ssv).find(ssv2) == std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(foo_ssv(ssv), ssv2);{{$}} + // CHECK-FIXES: !absl::StrContains(foo_ssv(ssv), ssv2); ssv.find(foo_ssv(ssv2)) != std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(ssv, foo_ssv(ssv2));{{$}} + // CHECK-FIXES: absl::StrContains(ssv, foo_ssv(ssv2)); foo_ssv(bar_ssv()).find(foo_ssv(ssv2)) != std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(foo_ssv(bar_ssv()), foo_ssv(ssv2));{{$}} + // CHECK-FIXES: absl::StrContains(foo_ssv(bar_ssv()), foo_ssv(ssv2)); absl::string_view asv, asv2; foo_asv(asv).find(asv2) == absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(foo_asv(asv), asv2);{{$}} + // CHECK-FIXES: !absl::StrContains(foo_asv(asv), asv2); asv.find(foo_asv(asv2)) != absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(asv, foo_asv(asv2));{{$}} + // CHECK-FIXES: absl::StrContains(asv, foo_asv(asv2)); foo_asv(bar_asv()).find(foo_asv(asv2)) != absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}absl::StrContains(foo_asv(bar_asv()), foo_asv(asv2));{{$}} + // CHECK-FIXES: absl::StrContains(foo_asv(bar_asv()), foo_asv(asv2)); } // Confirms that it works with string literal, char* and const char* parameters. @@ -191,58 +191,58 @@ void string_literal_and_char_ptr_tests() { std::string ss; ss.find("c") == std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ss, "c");{{$}} + // CHECK-FIXES: !absl::StrContains(ss, "c"); ss.find(c) == std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ss, c);{{$}} + // CHECK-FIXES: !absl::StrContains(ss, c); ss.find(cc) == std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ss, cc);{{$}} + // CHECK-FIXES: !absl::StrContains(ss, cc); std::string_view ssv; ssv.find("c") == std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ssv, "c");{{$}} + // CHECK-FIXES: !absl::StrContains(ssv, "c"); ssv.find(c) == std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ssv, c);{{$}} + // CHECK-FIXES: !absl::StrContains(ssv, c); ssv.find(cc) == std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ssv, cc);{{$}} + // CHECK-FIXES: !absl::StrContains(ssv, cc); absl::string_view asv; asv.find("c") == absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(asv, "c");{{$}} + // CHECK-FIXES: !absl::StrContains(asv, "c"); asv.find(c) == absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(asv, c);{{$}} + // CHECK-FIXES: !absl::StrContains(asv, c); asv.find(cc) == absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(asv, cc);{{$}} + // CHECK-FIXES: !absl::StrContains(asv, cc); } void char_param_tests() { std::string ss; ss.find('c') == std::string::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ss, 'c');{{$}} + // CHECK-FIXES: !absl::StrContains(ss, 'c'); std::string_view ssv; ssv.find('c') == std::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(ssv, 'c');{{$}} + // CHECK-FIXES: !absl::StrContains(ssv, 'c'); absl::string_view asv; asv.find('c') == absl::string_view::npos; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StrContains instead of - // CHECK-FIXES: {{^[[:space:]]*}}!absl::StrContains(asv, 'c');{{$}} + // CHECK-FIXES: !absl::StrContains(asv, 'c'); } #define FOO(a, b, c, d) ((a).find(b) == std::string::npos ? (c) : (d)) diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp index 3b977ad681adf..28b19ccdcf450 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp @@ -12,7 +12,7 @@ void g() { // CHECK-NOTES: [[@LINE+2]]:14: warning: argument name 'z' in comment does not match parameter name 'y' // CHECK-NOTES: [[@LINE-5]]:19: note: 'y' declared here f(/*y=*/0, /*z=*/0); - // CHECK-FIXES: {{^}} f(/*y=*/0, /*z=*/0); + // CHECK-FIXES: f(/*y=*/0, /*z=*/0); f(/*x=*/1, /*y=*/1); diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c index 0779738004076..38b5980c4038a 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c @@ -30,19 +30,19 @@ void numericConversion1(int I, double D) { numericConversion1(D, I); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion1' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters] // CHECK-MESSAGES: :[[@LINE-2]]:29: note: the first parameter in the range is 'I' // CHECK-MESSAGES: :[[@LINE-3]]:39: note: the last parameter in the range is 'D' -// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'double' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'double' may be implicitly converted void numericConversion2(int I, short S) { numericConversion2(S, I); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion2' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:29: note: the first parameter in the range is 'I' // CHECK-MESSAGES: :[[@LINE-3]]:38: note: the last parameter in the range is 'S' -// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'short' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'short' may be implicitly converted void numericConversion3(float F, unsigned long UL) { numericConversion3(UL, F); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion3' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:31: note: the first parameter in the range is 'F' // CHECK-MESSAGES: :[[@LINE-3]]:48: note: the last parameter in the range is 'UL' -// CHECK-MESSAGES: :[[@LINE-4]]:34: note: 'float' and 'unsigned long' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:34: note: 'float' and 'unsigned long' may be implicitly converted enum Unscoped { U_A, U_B }; @@ -53,25 +53,25 @@ void numericConversion4(int I, enum Unscoped U) { numericConversion4(U, I); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion4' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:29: note: the first parameter in the range is 'I' // CHECK-MESSAGES: :[[@LINE-3]]:46: note: the last parameter in the range is 'U' -// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'enum Unscoped' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'enum Unscoped' may be implicitly converted void numericConversion5(int I, enum UnscopedFixed UF) { numericConversion5(UF, I); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion5' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:29: note: the first parameter in the range is 'I' // CHECK-MESSAGES: :[[@LINE-3]]:51: note: the last parameter in the range is 'UF' -// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'enum UnscopedFixed' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'enum UnscopedFixed' may be implicitly converted void numericConversion7(double D, enum Unscoped U) { numericConversion7(U, D); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion7' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:32: note: the first parameter in the range is 'D' // CHECK-MESSAGES: :[[@LINE-3]]:49: note: the last parameter in the range is 'U' -// CHECK-MESSAGES: :[[@LINE-4]]:35: note: 'double' and 'enum Unscoped' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:35: note: 'double' and 'enum Unscoped' may be implicitly converted void numericConversion8(double D, enum UnscopedFixed UF) { numericConversion8(UF, D); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion8' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:32: note: the first parameter in the range is 'D' // CHECK-MESSAGES: :[[@LINE-3]]:54: note: the last parameter in the range is 'UF' -// CHECK-MESSAGES: :[[@LINE-4]]:35: note: 'double' and 'enum UnscopedFixed' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:35: note: 'double' and 'enum UnscopedFixed' may be implicitly converted void pointeeConversion(int *IP, double *DP) { pointeeConversion(DP, IP); } // NO-WARN: Even though this is possible in C, a swap is diagnosed by the compiler. diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.cpp index 7518e3fb031f5..149a3804f7bff 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.cpp @@ -74,19 +74,19 @@ void numericConversion1(int I, double D) { numericConversion1(D, I); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion1' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters] // CHECK-MESSAGES: :[[@LINE-2]]:29: note: the first parameter in the range is 'I' // CHECK-MESSAGES: :[[@LINE-3]]:39: note: the last parameter in the range is 'D' -// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'double' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'double' may be implicitly converted void numericConversion2(int I, short S) { numericConversion2(S, I); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion2' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:29: note: the first parameter in the range is 'I' // CHECK-MESSAGES: :[[@LINE-3]]:38: note: the last parameter in the range is 'S' -// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'short' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:32: note: 'int' and 'short' may be implicitly converted void numericConversion3(float F, unsigned long long ULL) { numericConversion3(ULL, F); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 2 adjacent parameters of 'numericConversion3' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:31: note: the first parameter in the range is 'F' // CHECK-MESSAGES: :[[@LINE-3]]:53: note: the last parameter in the range is 'ULL' -// CHECK-MESSAGES: :[[@LINE-4]]:34: note: 'float' and 'unsigned long long' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:34: note: 'float' and 'unsigned long long' may be implicitly converted enum Unscoped { U_A, U_B }; @@ -111,7 +111,7 @@ void numericConversionMultiUnique(int I, double D1, double D2) {} // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: 3 adjacent parameters of 'numericConversionMultiUnique' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:39: note: the first parameter in the range is 'I' // CHECK-MESSAGES: :[[@LINE-3]]:60: note: the last parameter in the range is 'D2' -// CHECK-MESSAGES: :[[@LINE-4]]:42: note: 'int' and 'double' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:42: note: 'int' and 'double' may be implicitly converted // (Note: int<->double conversion for I<->D2 not diagnosed again.) typedef int MyInt; @@ -176,7 +176,7 @@ void userDefinedConversion1(int I1, Integer I2) { userDefinedConversion1(I2, I1) // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: 2 adjacent parameters of 'userDefinedConversion1' of convertible types // CHECK-MESSAGES: :[[@LINE-2]]:33: note: the first parameter in the range is 'I1' // CHECK-MESSAGES: :[[@LINE-3]]:45: note: the last parameter in the range is 'I2' -// CHECK-MESSAGES: :[[@LINE-4]]:37: note: 'int' and 'Integer' may be implicitly converted{{$}} +// CHECK-MESSAGES: :[[@LINE-4]]:37: note: 'int' and 'Integer' may be implicitly converted // CHECK-MESSAGES: :[[@LINE-9]]:3: note: the implicit conversion involves the converting constructor declared here // CHECK-MESSAGES: :[[@LINE-9]]:3: note: the implicit conversion involves the conversion operator declared here diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/inaccurate-erase.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/inaccurate-erase.cpp index d29fa9cdd4e9b..dfb4b9e115fd5 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/inaccurate-erase.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/inaccurate-erase.cpp @@ -51,12 +51,12 @@ struct custom_container { template void g() { T t; t.erase(std::remove(t.begin(), t.end(), 10)); - // CHECK-FIXES: {{^ }}t.erase(std::remove(t.begin(), t.end(), 10));{{$}} + // CHECK-FIXES: t.erase(std::remove(t.begin(), t.end(), 10)); std::vector v; v.erase(remove(v.begin(), v.end(), 10)); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this call will remove at most one - // CHECK-FIXES: {{^ }}v.erase(remove(v.begin(), v.end(), 10), v.end());{{$}} + // CHECK-FIXES: v.erase(remove(v.begin(), v.end(), 10), v.end()); } #define ERASE(x, y) x.erase(remove(x.begin(), x.end(), y)) @@ -67,34 +67,34 @@ int main() { v.erase(remove(v.begin(), v.end(), 10)); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this call will remove at most one item even when multiple items should be removed [bugprone-inaccurate-erase] - // CHECK-FIXES: {{^ }}v.erase(remove(v.begin(), v.end(), 10), v.end());{{$}} + // CHECK-FIXES: v.erase(remove(v.begin(), v.end(), 10), v.end()); v.erase(remove(v.begin(), v.end(), 20), v.end()); auto *p = &v; p->erase(remove(p->begin(), p->end(), 11)); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this call will remove at most one - // CHECK-FIXES: {{^ }}p->erase(remove(p->begin(), p->end(), 11), p->end());{{$}} + // CHECK-FIXES: p->erase(remove(p->begin(), p->end(), 11), p->end()); std::vector_with_const_iterator v2; v2.erase(remove(v2.begin(), v2.end(), 12)); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this call will remove at most one - // CHECK-FIXES: {{^ }}v2.erase(remove(v2.begin(), v2.end(), 12), v2.end());{{$}} + // CHECK-FIXES: v2.erase(remove(v2.begin(), v2.end(), 12), v2.end()); // Fix is not trivial. auto it = v.end(); v.erase(remove(v.begin(), it, 10)); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this call will remove at most one - // CHECK-FIXES: {{^ }}v.erase(remove(v.begin(), it, 10));{{$}} + // CHECK-FIXES: v.erase(remove(v.begin(), it, 10)); g>(); g(); ERASE(v, 15); // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: this call will remove at most one - // CHECK-FIXES: {{^ }}ERASE(v, 15);{{$}} + // CHECK-FIXES: ERASE(v, 15); std::vector> vupi; auto iter = vupi.begin(); vupi.erase(iter++); - // CHECK-FIXES: {{^ }}vupi.erase(iter++);{{$}} + // CHECK-FIXES: vupi.erase(iter++); } diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/misplaced-operator-in-strlen-in-alloc.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/misplaced-operator-in-strlen-in-alloc.cpp index 58d63fa7afd5e..bc7b47e38fa98 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/misplaced-operator-in-strlen-in-alloc.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/misplaced-operator-in-strlen-in-alloc.cpp @@ -17,7 +17,7 @@ size_t strlen(const char *); void bad_std_malloc_std_strlen(char *name) { char *new_name = (char *)std::malloc(std::strlen(name + 1)); // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: addition operator is applied to the argument of strlen - // CHECK-FIXES: {{^ char \*new_name = \(char \*\)std::malloc\(}}std::strlen(name) + 1{{\);$}} + // CHECK-FIXES: char *new_name = (char *)std::malloc(std::strlen(name) + 1); } void ignore_non_std_malloc_std_strlen(char *name) { @@ -35,7 +35,7 @@ void ignore_std_malloc_non_std_strlen(char *name) { void bad_new_strlen(char *name) { char *new_name = new char[std::strlen(name + 1)]; // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: addition operator is applied to the argument of strlen - // CHECK-FIXES: {{^ char \*new_name = new char\[}}std::strlen(name) + 1{{\];$}} + // CHECK-FIXES: char *new_name = new char[std::strlen(name) + 1]; } void good_new_strlen(char *name) { @@ -54,5 +54,5 @@ class C { void bad_custom_new_strlen(char *name) { C *new_name = new C[std::strlen(name + 1)]; // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: addition operator is applied to the argument of strlen - // CHECK-FIXES: {{^ C \*new_name = new C\[}}std::strlen(name) + 1{{\];$}} + // CHECK-FIXES: C *new_name = new C[std::strlen(name) + 1]; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-invert.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-invert.cpp index 62ad8de7d3007..0dbd7443f8edf 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-invert.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-invert.cpp @@ -12,16 +12,16 @@ void __f() {} void f(); // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier 'f', which is not a reserved identifier [bugprone-reserved-identifier] -// CHECK-FIXES: {{^}}void __f();{{$}} +// CHECK-FIXES: void __f(); struct helper {}; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: declaration uses identifier 'helper', which is not a reserved identifier [bugprone-reserved-identifier] -// CHECK-FIXES: {{^}}struct __helper {};{{$}} +// CHECK-FIXES: struct __helper {}; struct Helper {}; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: declaration uses identifier 'Helper', which is not a reserved identifier [bugprone-reserved-identifier] -// CHECK-FIXES: {{^}}struct _Helper {};{{$}} +// CHECK-FIXES: struct _Helper {}; struct _helper2 {}; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: declaration uses identifier '_helper2', which is not a reserved identifier [bugprone-reserved-identifier] -// CHECK-FIXES: {{^}}struct __helper2 {};{{$}} +// CHECK-FIXES: struct __helper2 {}; template class reference_wrapper { @@ -53,11 +53,11 @@ ref(reference_wrapper<_Tp> __t) noexcept { template // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: declaration uses identifier 'Up', which is not a reserved identifier [bugprone-reserved-identifier] -// CHECK-FIXES: {{^}}template {{$}} +// CHECK-FIXES: template inline reference_wrapper cref(const Up &u) noexcept { // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: declaration uses identifier 'u', which is not a reserved identifier [bugprone-reserved-identifier] - // CHECK-FIXES: {{^}}cref(const _Up &__u) noexcept {{{$}} + // CHECK-FIXES: cref(const _Up &__u) noexcept { return reference_wrapper(u); } diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/string-integer-assignment.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/string-integer-assignment.cpp index 8db47ea190d8f..e127788bf6ca6 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/string-integer-assignment.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/string-integer-assignment.cpp @@ -33,26 +33,26 @@ int main() { s = 6; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: an integer is interpreted as a character code when assigning {{.*}} [bugprone-string-integer-assignment] -// CHECK-FIXES: {{^}} s = '6';{{$}} +// CHECK-FIXES: s = '6'; s = 66; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: an integer is interpreted as a chara -// CHECK-FIXES: {{^}} s = "66";{{$}} +// CHECK-FIXES: s = "66"; s = x; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: an integer is interpreted as a chara -// CHECK-FIXES: {{^}} s = std::to_string(x);{{$}} +// CHECK-FIXES: s = std::to_string(x); s = 'c'; s = static_cast(6); // += ws += 6; // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: an integer is interpreted as a chara -// CHECK-FIXES: {{^}} ws += L'6';{{$}} +// CHECK-FIXES: ws += L'6'; ws += 66; // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: an integer is interpreted as a chara -// CHECK-FIXES: {{^}} ws += L"66";{{$}} +// CHECK-FIXES: ws += L"66"; ws += x; // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: an integer is interpreted as a chara -// CHECK-FIXES: {{^}} ws += std::to_wstring(x);{{$}} +// CHECK-FIXES: ws += std::to_wstring(x); ws += L'c'; ws += (wchar_t)6; @@ -79,11 +79,11 @@ int main() { s += x % 26; s += 26 % x; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara - // CHECK-FIXES: {{^}} s += std::to_string(26 % x);{{$}} + // CHECK-FIXES: s += std::to_string(26 % x); s += c | 0x80; s += c | 0x8000; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara - // CHECK-FIXES: {{^}} s += std::to_string(c | 0x8000);{{$}} + // CHECK-FIXES: s += std::to_string(c | 0x8000); as += c | 0x8000; s += 'a' + (x % 26); @@ -94,7 +94,7 @@ int main() { s += x > 255 ? c : x; s += x > 255 ? 12 : x; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara - // CHECK-FIXES: {{^}} s += std::to_string(x > 255 ? 12 : x);{{$}} + // CHECK-FIXES: s += std::to_string(x > 255 ? 12 : x); } namespace instantiation_dependent_exprs { @@ -104,7 +104,7 @@ struct S { std::string s; void f(char c) { s += c | static_cast(t); } // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: an integer is interpreted as a chara - // CHECK-FIXES: {{^}} void f(char c) { s += std::to_string(c | static_cast(t)); } + // CHECK-FIXES: void f(char c) { s += std::to_string(c | static_cast(t)); } }; template struct S; diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp index 129a841b88eaa..050e38d8daa6d 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp @@ -134,124 +134,124 @@ void temporary_construction() /* a */ { { (void)(std::string_view(nullptr)) /* a1 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing basic_string_view from null is undefined; replace with the default constructor - // CHECK-FIXES: {{^}} (void)(std::string_view()) /* a1 */; + // CHECK-FIXES: (void)(std::string_view()) /* a1 */; (void)(std::string_view((nullptr))) /* a2 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view()) /* a2 */; + // CHECK-FIXES: (void)(std::string_view()) /* a2 */; (void)(std::string_view({nullptr})) /* a3 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view()) /* a3 */; + // CHECK-FIXES: (void)(std::string_view()) /* a3 */; (void)(std::string_view({(nullptr)})) /* a4 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view()) /* a4 */; + // CHECK-FIXES: (void)(std::string_view()) /* a4 */; (void)(std::string_view({})) /* a5 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view()) /* a5 */; + // CHECK-FIXES: (void)(std::string_view()) /* a5 */; } // Temporary Object { (void)(std::string_view{nullptr}) /* a6 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view{}) /* a6 */; + // CHECK-FIXES: (void)(std::string_view{}) /* a6 */; (void)(std::string_view{(nullptr)}) /* a7 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view{}) /* a7 */; + // CHECK-FIXES: (void)(std::string_view{}) /* a7 */; (void)(std::string_view{{nullptr}}) /* a8 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view{}) /* a8 */; + // CHECK-FIXES: (void)(std::string_view{}) /* a8 */; (void)(std::string_view{{(nullptr)}}) /* a9 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view{}) /* a9 */; + // CHECK-FIXES: (void)(std::string_view{}) /* a9 */; (void)(std::string_view{{}}) /* a10 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(std::string_view{}) /* a10 */; + // CHECK-FIXES: (void)(std::string_view{}) /* a10 */; } // C-Style Cast && Compound Literal { (void)((std::string_view) nullptr) /* a11 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((std::string_view) {}) /* a11 */; + // CHECK-FIXES: (void)((std::string_view) {}) /* a11 */; (void)((std::string_view)(nullptr)) /* a12 */; // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((std::string_view){}) /* a12 */; + // CHECK-FIXES: (void)((std::string_view){}) /* a12 */; (void)((std::string_view){nullptr}) /* a13 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((std::string_view){}) /* a13 */; + // CHECK-FIXES: (void)((std::string_view){}) /* a13 */; (void)((std::string_view){(nullptr)}) /* a14 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((std::string_view){}) /* a14 */; + // CHECK-FIXES: (void)((std::string_view){}) /* a14 */; (void)((std::string_view){{nullptr}}) /* a15 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((std::string_view){}) /* a15 */; + // CHECK-FIXES: (void)((std::string_view){}) /* a15 */; (void)((std::string_view){{(nullptr)}}) /* a16 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((std::string_view){}) /* a16 */; + // CHECK-FIXES: (void)((std::string_view){}) /* a16 */; (void)((std::string_view){{}}) /* a17 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((std::string_view){}) /* a17 */; + // CHECK-FIXES: (void)((std::string_view){}) /* a17 */; (void)((const std::string_view) nullptr) /* a18 */; // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((const std::string_view) {}) /* a18 */; + // CHECK-FIXES: (void)((const std::string_view) {}) /* a18 */; (void)((const std::string_view)(nullptr)) /* a19 */; // CHECK-MESSAGES: :[[@LINE-1]]:36: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((const std::string_view){}) /* a19 */; + // CHECK-FIXES: (void)((const std::string_view){}) /* a19 */; (void)((const std::string_view){nullptr}) /* a20 */; // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((const std::string_view){}) /* a20 */; + // CHECK-FIXES: (void)((const std::string_view){}) /* a20 */; (void)((const std::string_view){(nullptr)}) /* a21 */; // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((const std::string_view){}) /* a21 */; + // CHECK-FIXES: (void)((const std::string_view){}) /* a21 */; (void)((const std::string_view){{nullptr}}) /* a22 */; // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((const std::string_view){}) /* a22 */; + // CHECK-FIXES: (void)((const std::string_view){}) /* a22 */; (void)((const std::string_view){{(nullptr)}}) /* a23 */; // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((const std::string_view){}) /* a23 */; + // CHECK-FIXES: (void)((const std::string_view){}) /* a23 */; (void)((const std::string_view){{}}) /* a24 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)((const std::string_view){}) /* a24 */; + // CHECK-FIXES: (void)((const std::string_view){}) /* a24 */; } // Static Cast { (void)(static_cast(nullptr)) /* a25 */; // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: casting to basic_string_view from null is undefined; replace with the empty string - // CHECK-FIXES: {{^}} (void)(static_cast("")) /* a25 */; + // CHECK-FIXES: (void)(static_cast("")) /* a25 */; (void)(static_cast((nullptr))) /* a26 */; // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(static_cast("")) /* a26 */; + // CHECK-FIXES: (void)(static_cast("")) /* a26 */; (void)(static_cast(nullptr)) /* a27 */; // CHECK-MESSAGES: :[[@LINE-1]]:48: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(static_cast("")) /* a27 */; + // CHECK-FIXES: (void)(static_cast("")) /* a27 */; (void)(static_cast((nullptr))) /* a28 */; // CHECK-MESSAGES: :[[@LINE-1]]:48: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(static_cast("")) /* a28 */; + // CHECK-FIXES: (void)(static_cast("")) /* a28 */; } } @@ -260,240 +260,240 @@ void stack_construction() /* b */ { { std::string_view b1 = nullptr; // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b1 = {}; + // CHECK-FIXES: std::string_view b1 = {}; std::string_view b2 = (nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b2 = {}; + // CHECK-FIXES: std::string_view b2 = {}; const std::string_view b3 = nullptr; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b3 = {}; + // CHECK-FIXES: const std::string_view b3 = {}; const std::string_view b4 = (nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b4 = {}; + // CHECK-FIXES: const std::string_view b4 = {}; } // Copy Initialization With Temporary { std::string_view b5 = std::string_view(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b5 = std::string_view(); + // CHECK-FIXES: std::string_view b5 = std::string_view(); std::string_view b6 = std::string_view{nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b6 = std::string_view{}; + // CHECK-FIXES: std::string_view b6 = std::string_view{}; std::string_view b7 = (std::string_view) nullptr; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b7 = (std::string_view) {}; + // CHECK-FIXES: std::string_view b7 = (std::string_view) {}; std::string_view b8 = (std::string_view){nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b8 = (std::string_view){}; + // CHECK-FIXES: std::string_view b8 = (std::string_view){}; std::string_view b9 = static_cast(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} std::string_view b9 = static_cast(""); + // CHECK-FIXES: std::string_view b9 = static_cast(""); } // Copy List Initialization { std::string_view b10 = {nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b10 = {}; + // CHECK-FIXES: std::string_view b10 = {}; std::string_view b11 = {(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b11 = {}; + // CHECK-FIXES: std::string_view b11 = {}; std::string_view b12 = {{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b12 = {}; + // CHECK-FIXES: std::string_view b12 = {}; std::string_view b13 = {{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b13 = {}; + // CHECK-FIXES: std::string_view b13 = {}; std::string_view b14 = {{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b14 = {}; + // CHECK-FIXES: std::string_view b14 = {}; const std::string_view b15 = {nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b15 = {}; + // CHECK-FIXES: const std::string_view b15 = {}; const std::string_view b16 = {(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b16 = {}; + // CHECK-FIXES: const std::string_view b16 = {}; const std::string_view b17 = {{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b17 = {}; + // CHECK-FIXES: const std::string_view b17 = {}; const std::string_view b18 = {{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b18 = {}; + // CHECK-FIXES: const std::string_view b18 = {}; const std::string_view b19 = {{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b19 = {}; + // CHECK-FIXES: const std::string_view b19 = {}; } // Copy List Initialization With Temporary { std::string_view b20 = {std::string_view(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b20 = {std::string_view()}; + // CHECK-FIXES: std::string_view b20 = {std::string_view()}; std::string_view b21 = {std::string_view{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b21 = {std::string_view{}}; + // CHECK-FIXES: std::string_view b21 = {std::string_view{}}; std::string_view b22 = {(std::string_view) nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:48: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b22 = {(std::string_view) {}}; + // CHECK-FIXES: std::string_view b22 = {(std::string_view) {}}; std::string_view b23 = {(std::string_view){nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:48: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b23 = {(std::string_view){}}; + // CHECK-FIXES: std::string_view b23 = {(std::string_view){}}; std::string_view b24 = {static_cast(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} std::string_view b24 = {static_cast("")}; + // CHECK-FIXES: std::string_view b24 = {static_cast("")}; } // Direct Initialization { std::string_view b25(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b25; + // CHECK-FIXES: std::string_view b25; std::string_view b26((nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b26; + // CHECK-FIXES: std::string_view b26; std::string_view b27({nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b27; + // CHECK-FIXES: std::string_view b27; std::string_view b28({(nullptr)}); // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b28; + // CHECK-FIXES: std::string_view b28; std::string_view b29({}); // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b29; + // CHECK-FIXES: std::string_view b29; const std::string_view b30(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b30; + // CHECK-FIXES: const std::string_view b30; const std::string_view b31((nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b31; + // CHECK-FIXES: const std::string_view b31; const std::string_view b32({nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b32; + // CHECK-FIXES: const std::string_view b32; const std::string_view b33({(nullptr)}); // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b33; + // CHECK-FIXES: const std::string_view b33; const std::string_view b34({}); // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b34; + // CHECK-FIXES: const std::string_view b34; } // Direct Initialization With Temporary { std::string_view b35(std::string_view(nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b35(std::string_view()); + // CHECK-FIXES: std::string_view b35(std::string_view()); std::string_view b36(std::string_view{nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b36(std::string_view{}); + // CHECK-FIXES: std::string_view b36(std::string_view{}); std::string_view b37((std::string_view) nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b37((std::string_view) {}); + // CHECK-FIXES: std::string_view b37((std::string_view) {}); std::string_view b38((std::string_view){nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b38((std::string_view){}); + // CHECK-FIXES: std::string_view b38((std::string_view){}); std::string_view b39(static_cast(nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} std::string_view b39(static_cast("")); + // CHECK-FIXES: std::string_view b39(static_cast("")); } // Direct List Initialization { std::string_view b40{nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b40{}; + // CHECK-FIXES: std::string_view b40{}; std::string_view b41{(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b41{}; + // CHECK-FIXES: std::string_view b41{}; std::string_view b42{{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b42{}; + // CHECK-FIXES: std::string_view b42{}; std::string_view b43{{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b43{}; + // CHECK-FIXES: std::string_view b43{}; std::string_view b44{{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b44{}; + // CHECK-FIXES: std::string_view b44{}; const std::string_view b45{nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b45{}; + // CHECK-FIXES: const std::string_view b45{}; const std::string_view b46{(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b46{}; + // CHECK-FIXES: const std::string_view b46{}; const std::string_view b47{{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b47{}; + // CHECK-FIXES: const std::string_view b47{}; const std::string_view b48{{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b48{}; + // CHECK-FIXES: const std::string_view b48{}; const std::string_view b49{{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view b49{}; + // CHECK-FIXES: const std::string_view b49{}; } // Direct List Initialization With Temporary { std::string_view b50{std::string_view(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b50{std::string_view()}; + // CHECK-FIXES: std::string_view b50{std::string_view()}; std::string_view b51{std::string_view{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b51{std::string_view{}}; + // CHECK-FIXES: std::string_view b51{std::string_view{}}; std::string_view b52{(std::string_view) nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b52{(std::string_view) {}}; + // CHECK-FIXES: std::string_view b52{(std::string_view) {}}; std::string_view b53{(std::string_view){nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view b53{(std::string_view){}}; + // CHECK-FIXES: std::string_view b53{(std::string_view){}}; std::string_view b54{static_cast(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} std::string_view b54{static_cast("")}; + // CHECK-FIXES: std::string_view b54{static_cast("")}; } } @@ -503,169 +503,169 @@ void field_construction() /* c */ { struct DMICopyInitialization { std::string_view c1 = nullptr; // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c1 = {}; + // CHECK-FIXES: std::string_view c1 = {}; std::string_view c2 = (nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c2 = {}; + // CHECK-FIXES: std::string_view c2 = {}; const std::string_view c3 = nullptr; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c3 = {}; + // CHECK-FIXES: const std::string_view c3 = {}; const std::string_view c4 = (nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c4 = {}; + // CHECK-FIXES: const std::string_view c4 = {}; }; struct DMICopyInitializationWithTemporary { std::string_view c5 = std::string_view(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c5 = std::string_view(); + // CHECK-FIXES: std::string_view c5 = std::string_view(); std::string_view c6 = std::string_view{nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c6 = std::string_view{}; + // CHECK-FIXES: std::string_view c6 = std::string_view{}; std::string_view c7 = (std::string_view) nullptr; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c7 = (std::string_view) {}; + // CHECK-FIXES: std::string_view c7 = (std::string_view) {}; std::string_view c8 = (std::string_view){nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c8 = (std::string_view){}; + // CHECK-FIXES: std::string_view c8 = (std::string_view){}; std::string_view c9 = static_cast(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} std::string_view c9 = static_cast(""); + // CHECK-FIXES: std::string_view c9 = static_cast(""); }; struct DMICopyListInitialization { std::string_view c10 = {nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c10 = {}; + // CHECK-FIXES: std::string_view c10 = {}; std::string_view c11 = {(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c11 = {}; + // CHECK-FIXES: std::string_view c11 = {}; std::string_view c12 = {{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c12 = {}; + // CHECK-FIXES: std::string_view c12 = {}; std::string_view c13 = {{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c13 = {}; + // CHECK-FIXES: std::string_view c13 = {}; std::string_view c14 = {{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c14 = {}; + // CHECK-FIXES: std::string_view c14 = {}; const std::string_view c15 = {nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c15 = {}; + // CHECK-FIXES: const std::string_view c15 = {}; const std::string_view c16 = {(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c16 = {}; + // CHECK-FIXES: const std::string_view c16 = {}; const std::string_view c17 = {{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c17 = {}; + // CHECK-FIXES: const std::string_view c17 = {}; const std::string_view c18 = {{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c18 = {}; + // CHECK-FIXES: const std::string_view c18 = {}; const std::string_view c19 = {{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c19 = {}; + // CHECK-FIXES: const std::string_view c19 = {}; }; struct DMICopyListInitializationWithTemporary { std::string_view c20 = {std::string_view(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c20 = {std::string_view()}; + // CHECK-FIXES: std::string_view c20 = {std::string_view()}; std::string_view c21 = {std::string_view{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:46: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c21 = {std::string_view{}}; + // CHECK-FIXES: std::string_view c21 = {std::string_view{}}; std::string_view c22 = {(std::string_view) nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:48: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c22 = {(std::string_view) {}}; + // CHECK-FIXES: std::string_view c22 = {(std::string_view) {}}; std::string_view c23 = {(std::string_view){nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:48: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c23 = {(std::string_view){}}; + // CHECK-FIXES: std::string_view c23 = {(std::string_view){}}; std::string_view c24 = {static_cast(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} std::string_view c24 = {static_cast("")}; + // CHECK-FIXES: std::string_view c24 = {static_cast("")}; }; struct DMIDirectListInitialization { std::string_view c25{nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c25{}; + // CHECK-FIXES: std::string_view c25{}; std::string_view c26{(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c26{}; + // CHECK-FIXES: std::string_view c26{}; std::string_view c27{{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c27{}; + // CHECK-FIXES: std::string_view c27{}; std::string_view c28{{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c28{}; + // CHECK-FIXES: std::string_view c28{}; std::string_view c29{{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c29{}; + // CHECK-FIXES: std::string_view c29{}; const std::string_view c30{nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c30{}; + // CHECK-FIXES: const std::string_view c30{}; const std::string_view c31{(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c31{}; + // CHECK-FIXES: const std::string_view c31{}; const std::string_view c32{{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c32{}; + // CHECK-FIXES: const std::string_view c32{}; const std::string_view c33{{(nullptr)}}; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c33{}; + // CHECK-FIXES: const std::string_view c33{}; const std::string_view c34{{}}; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} const std::string_view c34{}; + // CHECK-FIXES: const std::string_view c34{}; }; struct DMIDirectListInitializationWithTemporary { std::string_view c35{std::string_view(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c35{std::string_view()}; + // CHECK-FIXES: std::string_view c35{std::string_view()}; std::string_view c36{std::string_view{nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c36{std::string_view{}}; + // CHECK-FIXES: std::string_view c36{std::string_view{}}; std::string_view c37{(std::string_view) nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c37{(std::string_view) {}}; + // CHECK-FIXES: std::string_view c37{(std::string_view) {}}; std::string_view c38{(std::string_view){nullptr}}; // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} std::string_view c38{(std::string_view){}}; + // CHECK-FIXES: std::string_view c38{(std::string_view){}}; std::string_view c39{static_cast(nullptr)}; // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} std::string_view c39{static_cast("")}; + // CHECK-FIXES: std::string_view c39{static_cast("")}; }; // Constructor Initializers @@ -680,23 +680,23 @@ void field_construction() /* c */ { CIDirectInitialization() : c40(nullptr), // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} : c40(), + // CHECK-FIXES: : c40(), c41((nullptr)), // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c41(), + // CHECK-FIXES: c41(), c42({nullptr}), // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c42(), + // CHECK-FIXES: c42(), c43({(nullptr)}), // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c43(), + // CHECK-FIXES: c43(), c44({}) { // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c44() { + // CHECK-FIXES: c44() { } }; @@ -710,23 +710,23 @@ void field_construction() /* c */ { CIDirectInitializationWithTemporary() : c45(std::string_view(nullptr)), // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} : c45(std::string_view()), + // CHECK-FIXES: : c45(std::string_view()), c46(std::string_view{nullptr}), // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c46(std::string_view{}), + // CHECK-FIXES: c46(std::string_view{}), c47((std::string_view) nullptr), // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c47((std::string_view) {}), + // CHECK-FIXES: c47((std::string_view) {}), c48((std::string_view){nullptr}), // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c48((std::string_view){}), + // CHECK-FIXES: c48((std::string_view){}), c49(static_cast(nullptr)) { // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} c49(static_cast("")) { + // CHECK-FIXES: c49(static_cast("")) { } }; @@ -740,23 +740,23 @@ void field_construction() /* c */ { CIDirectListInitialization() : c50{nullptr}, // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} : c50{}, + // CHECK-FIXES: : c50{}, c51{(nullptr)}, // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c51{}, + // CHECK-FIXES: c51{}, c52{{nullptr}}, // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c52{}, + // CHECK-FIXES: c52{}, c53{{(nullptr)}}, // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c53{}, + // CHECK-FIXES: c53{}, c54{{}} { // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c54{} { + // CHECK-FIXES: c54{} { } }; @@ -770,23 +770,23 @@ void field_construction() /* c */ { CIDirectListInitializationWithTemporary() : c55{std::string_view(nullptr)}, // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} : c55{std::string_view()}, + // CHECK-FIXES: : c55{std::string_view()}, c56{std::string_view{nullptr}}, // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c56{std::string_view{}}, + // CHECK-FIXES: c56{std::string_view{}}, c57{(std::string_view) nullptr}, // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c57{(std::string_view) {}}, + // CHECK-FIXES: c57{(std::string_view) {}}, c58{(std::string_view){nullptr}}, // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} c58{(std::string_view){}}, + // CHECK-FIXES: c58{(std::string_view){}}, c59{static_cast(nullptr)} { // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} c59{static_cast("")} { + // CHECK-FIXES: c59{static_cast("")} { } }; } @@ -796,108 +796,108 @@ void default_argument_construction() /* d */ { { void d1(std::string_view sv = nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d1(std::string_view sv = {}); + // CHECK-FIXES: void d1(std::string_view sv = {}); void d2(std::string_view sv = (nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d2(std::string_view sv = {}); + // CHECK-FIXES: void d2(std::string_view sv = {}); void d3(const std::string_view sv = nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:41: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d3(const std::string_view sv = {}); + // CHECK-FIXES: void d3(const std::string_view sv = {}); void d4(const std::string_view sv = (nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:41: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d4(const std::string_view sv = {}); + // CHECK-FIXES: void d4(const std::string_view sv = {}); } // Copy Initialization With Temporary { void d5(std::string_view sv = std::string_view(nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:52: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d5(std::string_view sv = std::string_view()); + // CHECK-FIXES: void d5(std::string_view sv = std::string_view()); void d6(std::string_view sv = std::string_view{nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:52: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d6(std::string_view sv = std::string_view{}); + // CHECK-FIXES: void d6(std::string_view sv = std::string_view{}); void d7(std::string_view sv = (std::string_view) nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:54: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d7(std::string_view sv = (std::string_view) {}); + // CHECK-FIXES: void d7(std::string_view sv = (std::string_view) {}); void d8(std::string_view sv = (std::string_view){nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:54: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d8(std::string_view sv = (std::string_view){}); + // CHECK-FIXES: void d8(std::string_view sv = (std::string_view){}); void d9(std::string_view sv = static_cast(nullptr)); // CHECK-MESSAGES: :[[@LINE-1]]:51: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} void d9(std::string_view sv = static_cast("")); + // CHECK-FIXES: void d9(std::string_view sv = static_cast("")); } // Copy List Initialization { void d10(std::string_view sv = {nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d10(std::string_view sv = {}); + // CHECK-FIXES: void d10(std::string_view sv = {}); void d11(std::string_view sv = {(nullptr)}); // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d11(std::string_view sv = {}); + // CHECK-FIXES: void d11(std::string_view sv = {}); void d12(std::string_view sv = {{nullptr}}); // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d12(std::string_view sv = {}); + // CHECK-FIXES: void d12(std::string_view sv = {}); void d13(std::string_view sv = {{(nullptr)}}); // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d13(std::string_view sv = {}); + // CHECK-FIXES: void d13(std::string_view sv = {}); void d14(std::string_view sv = {{}}); // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d14(std::string_view sv = {}); + // CHECK-FIXES: void d14(std::string_view sv = {}); void d15(const std::string_view sv = {nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d15(const std::string_view sv = {}); + // CHECK-FIXES: void d15(const std::string_view sv = {}); void d16(const std::string_view sv = {(nullptr)}); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d16(const std::string_view sv = {}); + // CHECK-FIXES: void d16(const std::string_view sv = {}); void d17(const std::string_view sv = {{nullptr}}); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d17(const std::string_view sv = {}); + // CHECK-FIXES: void d17(const std::string_view sv = {}); void d18(const std::string_view sv = {{(nullptr)}}); // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d18(const std::string_view sv = {}); + // CHECK-FIXES: void d18(const std::string_view sv = {}); void d19(const std::string_view sv = {{}}); // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d19(const std::string_view sv = {}); + // CHECK-FIXES: void d19(const std::string_view sv = {}); } // Copy List Initialization With Temporary { void d20(std::string_view sv = {std::string_view(nullptr)}); // CHECK-MESSAGES: :[[@LINE-1]]:54: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d20(std::string_view sv = {std::string_view()}); + // CHECK-FIXES: void d20(std::string_view sv = {std::string_view()}); void d21(std::string_view sv = {std::string_view{nullptr}}); // CHECK-MESSAGES: :[[@LINE-1]]:54: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d21(std::string_view sv = {std::string_view{}}); + // CHECK-FIXES: void d21(std::string_view sv = {std::string_view{}}); void d22(std::string_view sv = {(std::string_view) nullptr}); // CHECK-MESSAGES: :[[@LINE-1]]:56: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d22(std::string_view sv = {(std::string_view) {}}); + // CHECK-FIXES: void d22(std::string_view sv = {(std::string_view) {}}); void d23(std::string_view sv = {(std::string_view){nullptr}}); // CHECK-MESSAGES: :[[@LINE-1]]:56: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} void d23(std::string_view sv = {(std::string_view){}}); + // CHECK-FIXES: void d23(std::string_view sv = {(std::string_view){}}); void d24(std::string_view sv = {static_cast(nullptr)}); // CHECK-MESSAGES: :[[@LINE-1]]:53: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} void d24(std::string_view sv = {static_cast("")}); + // CHECK-FIXES: void d24(std::string_view sv = {static_cast("")}); } } @@ -906,132 +906,132 @@ void heap_construction() /* e */ { { (void)(new std::string_view(nullptr)) /* e1 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view()) /* e1 */; + // CHECK-FIXES: (void)(new std::string_view()) /* e1 */; (void)(new std::string_view((nullptr))) /* e2 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view()) /* e2 */; + // CHECK-FIXES: (void)(new std::string_view()) /* e2 */; (void)(new std::string_view({nullptr})) /* e3 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view()) /* e3 */; + // CHECK-FIXES: (void)(new std::string_view()) /* e3 */; (void)(new std::string_view({(nullptr)})) /* e4 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view()) /* e4 */; + // CHECK-FIXES: (void)(new std::string_view()) /* e4 */; (void)(new std::string_view({})) /* e5 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view()) /* e5 */; + // CHECK-FIXES: (void)(new std::string_view()) /* e5 */; (void)(new const std::string_view(nullptr)) /* e6 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view()) /* e6 */; + // CHECK-FIXES: (void)(new const std::string_view()) /* e6 */; (void)(new const std::string_view((nullptr))) /* e7 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view()) /* e7 */; + // CHECK-FIXES: (void)(new const std::string_view()) /* e7 */; (void)(new const std::string_view({nullptr})) /* e8 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view()) /* e8 */; + // CHECK-FIXES: (void)(new const std::string_view()) /* e8 */; (void)(new const std::string_view({(nullptr)})) /* e9 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view()) /* e9 */; + // CHECK-FIXES: (void)(new const std::string_view()) /* e9 */; (void)(new const std::string_view({})) /* e10 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view()) /* e10 */; + // CHECK-FIXES: (void)(new const std::string_view()) /* e10 */; } // Direct Initialization With Temporary { (void)(new std::string_view(std::string_view(nullptr))) /* e11 */; // CHECK-MESSAGES: :[[@LINE-1]]:50: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view(std::string_view())) /* e11 */; + // CHECK-FIXES: (void)(new std::string_view(std::string_view())) /* e11 */; (void)(new std::string_view(std::string_view{nullptr})) /* e12 */; // CHECK-MESSAGES: :[[@LINE-1]]:50: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view(std::string_view{})) /* e12 */; + // CHECK-FIXES: (void)(new std::string_view(std::string_view{})) /* e12 */; (void)(new std::string_view((std::string_view) nullptr)) /* e13 */; // CHECK-MESSAGES: :[[@LINE-1]]:52: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view((std::string_view) {})) /* e13 */; + // CHECK-FIXES: (void)(new std::string_view((std::string_view) {})) /* e13 */; (void)(new std::string_view((std::string_view){nullptr})) /* e14 */; // CHECK-MESSAGES: :[[@LINE-1]]:52: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view((std::string_view){})) /* e14 */; + // CHECK-FIXES: (void)(new std::string_view((std::string_view){})) /* e14 */; (void)(new std::string_view(static_cast(nullptr))) /* e15 */; // CHECK-MESSAGES: :[[@LINE-1]]:49: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(new std::string_view(static_cast(""))) /* e15 */; + // CHECK-FIXES: (void)(new std::string_view(static_cast(""))) /* e15 */; } // Direct List Initialization { (void)(new std::string_view{nullptr}) /* e16 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{}) /* e16 */; + // CHECK-FIXES: (void)(new std::string_view{}) /* e16 */; (void)(new std::string_view{(nullptr)}) /* e17 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{}) /* e17 */; + // CHECK-FIXES: (void)(new std::string_view{}) /* e17 */; (void)(new std::string_view{{nullptr}}) /* e18 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{}) /* e18 */; + // CHECK-FIXES: (void)(new std::string_view{}) /* e18 */; (void)(new std::string_view{{(nullptr)}}) /* e19 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{}) /* e19 */; + // CHECK-FIXES: (void)(new std::string_view{}) /* e19 */; (void)(new std::string_view{{}}) /* e20 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{}) /* e20 */; + // CHECK-FIXES: (void)(new std::string_view{}) /* e20 */; (void)(new const std::string_view{nullptr}) /* e21 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view{}) /* e21 */; + // CHECK-FIXES: (void)(new const std::string_view{}) /* e21 */; (void)(new const std::string_view{(nullptr)}) /* e22 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view{}) /* e22 */; + // CHECK-FIXES: (void)(new const std::string_view{}) /* e22 */; (void)(new const std::string_view{{nullptr}}) /* e23 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view{}) /* e23 */; + // CHECK-FIXES: (void)(new const std::string_view{}) /* e23 */; (void)(new const std::string_view{{(nullptr)}}) /* e24 */; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view{}) /* e24 */; + // CHECK-FIXES: (void)(new const std::string_view{}) /* e24 */; (void)(new const std::string_view{{}}) /* e25 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new const std::string_view{}) /* e25 */; + // CHECK-FIXES: (void)(new const std::string_view{}) /* e25 */; } // Direct List Initialization With Temporary { (void)(new std::string_view{std::string_view(nullptr)}) /* e26 */; // CHECK-MESSAGES: :[[@LINE-1]]:50: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{std::string_view()}) /* e26 */; + // CHECK-FIXES: (void)(new std::string_view{std::string_view()}) /* e26 */; (void)(new std::string_view{std::string_view{nullptr}}) /* e27 */; // CHECK-MESSAGES: :[[@LINE-1]]:50: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{std::string_view{}}) /* e27 */; + // CHECK-FIXES: (void)(new std::string_view{std::string_view{}}) /* e27 */; (void)(new std::string_view{(std::string_view) nullptr}) /* e28 */; // CHECK-MESSAGES: :[[@LINE-1]]:52: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{(std::string_view) {}}) /* e28 */; + // CHECK-FIXES: (void)(new std::string_view{(std::string_view) {}}) /* e28 */; (void)(new std::string_view{(std::string_view){nullptr}}) /* e29 */; // CHECK-MESSAGES: :[[@LINE-1]]:52: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(new std::string_view{(std::string_view){}}) /* e29 */; + // CHECK-FIXES: (void)(new std::string_view{(std::string_view){}}) /* e29 */; (void)(new std::string_view{static_cast(nullptr)}) /* e30 */; // CHECK-MESSAGES: :[[@LINE-1]]:49: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(new std::string_view{static_cast("")}) /* e30 */; + // CHECK-FIXES: (void)(new std::string_view{static_cast("")}) /* e30 */; } } @@ -1040,46 +1040,46 @@ void function_argument_initialization() /* f */ { { function(nullptr) /* f1 */; // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: passing null as basic_string_view is undefined; replace with the empty string - // CHECK-FIXES: {{^}} function("") /* f1 */; + // CHECK-FIXES: function("") /* f1 */; function((nullptr)) /* f2 */; // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: passing{{.*}}empty string - // CHECK-FIXES: {{^}} function("") /* f2 */; + // CHECK-FIXES: function("") /* f2 */; function({nullptr}) /* f3 */; // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: passing{{.*}}empty string - // CHECK-FIXES: {{^}} function("") /* f3 */; + // CHECK-FIXES: function("") /* f3 */; function({(nullptr)}) /* f4 */; // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: passing{{.*}}empty string - // CHECK-FIXES: {{^}} function("") /* f4 */; + // CHECK-FIXES: function("") /* f4 */; function({{}}) /* f5 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: passing{{.*}}empty string - // CHECK-FIXES: {{^}} function("") /* f5 */; + // CHECK-FIXES: function("") /* f5 */; } // Function Argument Initialization With Temporary { function(std::string_view(nullptr)) /* f6 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} function(std::string_view()) /* f6 */; + // CHECK-FIXES: function(std::string_view()) /* f6 */; function(std::string_view{nullptr}) /* f7 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} function(std::string_view{}) /* f7 */; + // CHECK-FIXES: function(std::string_view{}) /* f7 */; function((std::string_view) nullptr) /* f8 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} function((std::string_view) {}) /* f8 */; + // CHECK-FIXES: function((std::string_view) {}) /* f8 */; function((std::string_view){nullptr}) /* f9 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} function((std::string_view){}) /* f9 */; + // CHECK-FIXES: function((std::string_view){}) /* f9 */; function(static_cast(nullptr)) /* f10 */; // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} function(static_cast("")) /* f10 */; + // CHECK-FIXES: function(static_cast("")) /* f10 */; } } @@ -1088,46 +1088,46 @@ void assignment(std::string_view sv) /* g */ { { sv = nullptr /* g1 */; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: assignment to basic_string_view from null is undefined; replace with the default constructor - // CHECK-FIXES: {{^}} sv = {} /* g1 */; + // CHECK-FIXES: sv = {} /* g1 */; sv = (nullptr) /* g2 */; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} sv = {} /* g2 */; + // CHECK-FIXES: sv = {} /* g2 */; sv = {nullptr} /* g3 */; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} sv = {} /* g3 */; + // CHECK-FIXES: sv = {} /* g3 */; sv = {(nullptr)} /* g4 */; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} sv = {} /* g4 */; + // CHECK-FIXES: sv = {} /* g4 */; sv = {{}} /* g5 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} sv = {} /* g5 */; + // CHECK-FIXES: sv = {} /* g5 */; } // Assignment With Temporary { sv = std::string_view(nullptr) /* g6 */; // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} sv = std::string_view() /* g6 */; + // CHECK-FIXES: sv = std::string_view() /* g6 */; sv = std::string_view{nullptr} /* g7 */; // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} sv = std::string_view{} /* g7 */; + // CHECK-FIXES: sv = std::string_view{} /* g7 */; sv = (std::string_view) nullptr /* g8 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} sv = (std::string_view) {} /* g8 */; + // CHECK-FIXES: sv = (std::string_view) {} /* g8 */; sv = (std::string_view){nullptr} /* g9 */; // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} sv = (std::string_view){} /* g9 */; + // CHECK-FIXES: sv = (std::string_view){} /* g9 */; sv = static_cast(nullptr) /* g10 */; // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} sv = static_cast("") /* g10 */; + // CHECK-FIXES: sv = static_cast("") /* g10 */; } } @@ -1136,46 +1136,46 @@ void pointer_assignment(std::string_view *sv_ptr) /* h */ { { *sv_ptr = nullptr /* h1 */; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = {} /* h1 */; + // CHECK-FIXES: *sv_ptr = {} /* h1 */; *sv_ptr = (nullptr) /* h2 */; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = {} /* h2 */; + // CHECK-FIXES: *sv_ptr = {} /* h2 */; *sv_ptr = {nullptr} /* h3 */; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = {} /* h3 */; + // CHECK-FIXES: *sv_ptr = {} /* h3 */; *sv_ptr = {(nullptr)} /* h4 */; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = {} /* h4 */; + // CHECK-FIXES: *sv_ptr = {} /* h4 */; *sv_ptr = {{}} /* h5 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: assignment{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = {} /* h5 */; + // CHECK-FIXES: *sv_ptr = {} /* h5 */; } // Assignment With Temporary { *sv_ptr = std::string_view(nullptr) /* h6 */; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = std::string_view() /* h6 */; + // CHECK-FIXES: *sv_ptr = std::string_view() /* h6 */; *sv_ptr = std::string_view{nullptr} /* h7 */; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = std::string_view{} /* h7 */; + // CHECK-FIXES: *sv_ptr = std::string_view{} /* h7 */; *sv_ptr = (std::string_view) nullptr /* h8 */; // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = (std::string_view) {} /* h8 */; + // CHECK-FIXES: *sv_ptr = (std::string_view) {} /* h8 */; *sv_ptr = (std::string_view){nullptr} /* h9 */; // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} *sv_ptr = (std::string_view){} /* h9 */; + // CHECK-FIXES: *sv_ptr = (std::string_view){} /* h9 */; *sv_ptr = static_cast(nullptr) /* h10 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} *sv_ptr = static_cast("") /* h10 */; + // CHECK-FIXES: *sv_ptr = static_cast("") /* h10 */; } } @@ -1184,38 +1184,38 @@ void lesser_comparison(std::string_view sv) /* i */ { { (void)(sv < nullptr) /* i1 */; // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: comparing basic_string_view to null is undefined; replace with the empty string - // CHECK-FIXES: {{^}} (void)(sv < "") /* i1 */; + // CHECK-FIXES: (void)(sv < "") /* i1 */; (void)(sv < (nullptr)) /* i2 */; // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv < "") /* i2 */; + // CHECK-FIXES: (void)(sv < "") /* i2 */; (void)(nullptr < sv) /* i3 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" < sv) /* i3 */; + // CHECK-FIXES: (void)("" < sv) /* i3 */; (void)((nullptr) < sv) /* i4 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" < sv) /* i4 */; + // CHECK-FIXES: (void)("" < sv) /* i4 */; } // With Equality { (void)(sv <= nullptr) /* i5 */; // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv <= "") /* i5 */; + // CHECK-FIXES: (void)(sv <= "") /* i5 */; (void)(sv <= (nullptr)) /* i6 */; // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv <= "") /* i6 */; + // CHECK-FIXES: (void)(sv <= "") /* i6 */; (void)(nullptr <= sv) /* i7 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" <= sv) /* i7 */; + // CHECK-FIXES: (void)("" <= sv) /* i7 */; (void)((nullptr) <= sv) /* i8 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" <= sv) /* i8 */; + // CHECK-FIXES: (void)("" <= sv) /* i8 */; } } @@ -1224,38 +1224,38 @@ void pointer_lesser_comparison(std::string_view *sv_ptr) /* j */ { { (void)(*sv_ptr < nullptr) /* j1 */; // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr < "") /* j1 */; + // CHECK-FIXES: (void)(*sv_ptr < "") /* j1 */; (void)(*sv_ptr < (nullptr)) /* j2 */; // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr < "") /* j2 */; + // CHECK-FIXES: (void)(*sv_ptr < "") /* j2 */; (void)(nullptr < *sv_ptr) /* j3 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" < *sv_ptr) /* j3 */; + // CHECK-FIXES: (void)("" < *sv_ptr) /* j3 */; (void)((nullptr) < *sv_ptr) /* j4 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" < *sv_ptr) /* j4 */; + // CHECK-FIXES: (void)("" < *sv_ptr) /* j4 */; } // With Equality { (void)(*sv_ptr <= nullptr) /* j5 */; // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr <= "") /* j5 */; + // CHECK-FIXES: (void)(*sv_ptr <= "") /* j5 */; (void)(*sv_ptr <= (nullptr)) /* j6 */; // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr <= "") /* j6 */; + // CHECK-FIXES: (void)(*sv_ptr <= "") /* j6 */; (void)(nullptr <= *sv_ptr) /* j7 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" <= *sv_ptr) /* j7 */; + // CHECK-FIXES: (void)("" <= *sv_ptr) /* j7 */; (void)((nullptr) <= *sv_ptr) /* j8 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" <= *sv_ptr) /* j8 */; + // CHECK-FIXES: (void)("" <= *sv_ptr) /* j8 */; } } @@ -1264,38 +1264,38 @@ void greater_comparison(std::string_view sv) /* k */ { { (void)(sv > nullptr) /* k1 */; // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv > "") /* k1 */; + // CHECK-FIXES: (void)(sv > "") /* k1 */; (void)(sv > (nullptr)) /* k2 */; // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv > "") /* k2 */; + // CHECK-FIXES: (void)(sv > "") /* k2 */; (void)(nullptr > sv) /* k3 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" > sv) /* k3 */; + // CHECK-FIXES: (void)("" > sv) /* k3 */; (void)((nullptr) > sv) /* k4 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" > sv) /* k4 */; + // CHECK-FIXES: (void)("" > sv) /* k4 */; } // With Equality { (void)(sv >= nullptr) /* k5 */; // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv >= "") /* k5 */; + // CHECK-FIXES: (void)(sv >= "") /* k5 */; (void)(sv >= (nullptr)) /* k6 */; // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv >= "") /* k6 */; + // CHECK-FIXES: (void)(sv >= "") /* k6 */; (void)(nullptr >= sv) /* k7 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" >= sv) /* k7 */; + // CHECK-FIXES: (void)("" >= sv) /* k7 */; (void)((nullptr) >= sv) /* k8 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" >= sv) /* k8 */; + // CHECK-FIXES: (void)("" >= sv) /* k8 */; } } @@ -1304,61 +1304,61 @@ void pointer_greater_comparison(std::string_view *sv_ptr) /* l */ { { (void)(*sv_ptr > nullptr) /* l1 */; // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr > "") /* l1 */; + // CHECK-FIXES: (void)(*sv_ptr > "") /* l1 */; (void)(*sv_ptr > (nullptr)) /* l2 */; // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr > "") /* l2 */; + // CHECK-FIXES: (void)(*sv_ptr > "") /* l2 */; (void)(nullptr > *sv_ptr) /* l3 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" > *sv_ptr) /* l3 */; + // CHECK-FIXES: (void)("" > *sv_ptr) /* l3 */; (void)((nullptr) > *sv_ptr) /* l4 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" > *sv_ptr) /* l4 */; + // CHECK-FIXES: (void)("" > *sv_ptr) /* l4 */; } // With Equality { (void)(*sv_ptr >= nullptr) /* l5 */; // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr >= "") /* l5 */; + // CHECK-FIXES: (void)(*sv_ptr >= "") /* l5 */; (void)(*sv_ptr >= (nullptr)) /* l6 */; // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(*sv_ptr >= "") /* l6 */; + // CHECK-FIXES: (void)(*sv_ptr >= "") /* l6 */; (void)(nullptr >= *sv_ptr) /* l7 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" >= *sv_ptr) /* l7 */; + // CHECK-FIXES: (void)("" >= *sv_ptr) /* l7 */; (void)((nullptr) >= *sv_ptr) /* l8 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)("" >= *sv_ptr) /* l8 */; + // CHECK-FIXES: (void)("" >= *sv_ptr) /* l8 */; } } void relative_comparison_with_temporary(std::string_view sv) /* m */ { (void)(sv < std::string_view(nullptr)) /* m1 */; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv < std::string_view()) /* m1 */; + // CHECK-FIXES: (void)(sv < std::string_view()) /* m1 */; (void)(sv < std::string_view{nullptr}) /* m2 */; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv < std::string_view{}) /* m2 */; + // CHECK-FIXES: (void)(sv < std::string_view{}) /* m2 */; (void)(sv < (std::string_view) nullptr) /* m3 */; // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv < (std::string_view) {}) /* m3 */; + // CHECK-FIXES: (void)(sv < (std::string_view) {}) /* m3 */; (void)(sv < (std::string_view){nullptr}) /* m4 */; // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv < (std::string_view){}) /* m4 */; + // CHECK-FIXES: (void)(sv < (std::string_view){}) /* m4 */; (void)(sv < static_cast(nullptr)) /* m5 */; // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv < static_cast("")) /* m5 */; + // CHECK-FIXES: (void)(sv < static_cast("")) /* m5 */; } void equality_comparison(std::string_view sv) /* n */ { @@ -1366,76 +1366,76 @@ void equality_comparison(std::string_view sv) /* n */ { { (void)(sv == nullptr) /* n1 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing basic_string_view to null is undefined; replace with the emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n1 */; + // CHECK-FIXES: (void)(sv.empty()) /* n1 */; (void)(sv == (nullptr)) /* n2 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n2 */; + // CHECK-FIXES: (void)(sv.empty()) /* n2 */; (void)(nullptr == sv) /* n3 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n3 */; + // CHECK-FIXES: (void)(sv.empty()) /* n3 */; (void)((nullptr) == sv) /* n4 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n4 */; + // CHECK-FIXES: (void)(sv.empty()) /* n4 */; } // Empty With Parens { (void)((sv) == nullptr) /* n5 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing basic_string_view to null is undefined; replace with the emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n5 */; + // CHECK-FIXES: (void)(sv.empty()) /* n5 */; (void)((sv) == (nullptr)) /* n6 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n6 */; + // CHECK-FIXES: (void)(sv.empty()) /* n6 */; (void)(nullptr == (sv)) /* n7 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n7 */; + // CHECK-FIXES: (void)(sv.empty()) /* n7 */; (void)((nullptr) == (sv)) /* n8 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv.empty()) /* n8 */; + // CHECK-FIXES: (void)(sv.empty()) /* n8 */; } // Non-Empty Without Parens { (void)((sv) != nullptr) /* n9 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n9 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n9 */; (void)((sv) != (nullptr)) /* n10 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n10 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n10 */; (void)(nullptr != (sv)) /* n11 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n11 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n11 */; (void)((nullptr) != (sv)) /* n12 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n12 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n12 */; } // Non-Empty With Parens { (void)((sv) != nullptr) /* n13 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n13 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n13 */; (void)((sv) != (nullptr)) /* n14 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n14 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n14 */; (void)(nullptr != (sv)) /* n15 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n15 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n15 */; (void)((nullptr) != (sv)) /* n16 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv.empty()) /* n16 */; + // CHECK-FIXES: (void)(!sv.empty()) /* n16 */; } } @@ -1444,99 +1444,99 @@ void pointer_equality_comparison(std::string_view *sv_ptr) /* o */ { { (void)(*sv_ptr == nullptr) /* o1 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o1 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o1 */; (void)(*sv_ptr == (nullptr)) /* o2 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o2 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o2 */; (void)(nullptr == *sv_ptr) /* o3 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o3 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o3 */; (void)((nullptr) == *sv_ptr) /* o4 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o4 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o4 */; } // Empty With Parens { (void)((*sv_ptr) == nullptr) /* o5 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o5 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o5 */; (void)((*sv_ptr) == (nullptr)) /* o6 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o6 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o6 */; (void)(nullptr == (*sv_ptr)) /* o7 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o7 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o7 */; (void)((nullptr) == (*sv_ptr)) /* o8 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(sv_ptr->empty()) /* o8 */; + // CHECK-FIXES: (void)(sv_ptr->empty()) /* o8 */; } // Non-Empty With Parens { (void)((*sv_ptr) != nullptr) /* o9 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o9 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o9 */; (void)((*sv_ptr) != (nullptr)) /* o10 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o10 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o10 */; (void)(nullptr != (*sv_ptr)) /* o11 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o11 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o11 */; (void)((nullptr) != (*sv_ptr)) /* o12 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o12 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o12 */; } // Non-Empty Without Parens { (void)((*sv_ptr) != nullptr) /* o13 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o13 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o13 */; (void)((*sv_ptr) != (nullptr)) /* o14 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o14 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o14 */; (void)(nullptr != (*sv_ptr)) /* o15 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o15 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o15 */; (void)((nullptr) != (*sv_ptr)) /* o16 */; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: comparing{{.*}}emptiness query - // CHECK-FIXES: {{^}} (void)(!sv_ptr->empty()) /* o16 */; + // CHECK-FIXES: (void)(!sv_ptr->empty()) /* o16 */; } } void equality_comparison_with_temporary(std::string_view sv) /* p */ { (void)(sv == std::string_view(nullptr)) /* p1 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv == std::string_view()) /* p1 */; + // CHECK-FIXES: (void)(sv == std::string_view()) /* p1 */; (void)(sv == std::string_view{nullptr}) /* p2 */; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv == std::string_view{}) /* p2 */; + // CHECK-FIXES: (void)(sv == std::string_view{}) /* p2 */; (void)(sv == (std::string_view) nullptr) /* p3 */; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv == (std::string_view) {}) /* p3 */; + // CHECK-FIXES: (void)(sv == (std::string_view) {}) /* p3 */; (void)(sv == (std::string_view){nullptr}) /* p4 */; // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} (void)(sv == (std::string_view){}) /* p4 */; + // CHECK-FIXES: (void)(sv == (std::string_view){}) /* p4 */; (void)(sv == static_cast(nullptr)) /* p5 */; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(sv == static_cast("")) /* p5 */; + // CHECK-FIXES: (void)(sv == static_cast("")) /* p5 */; } void return_statement() /* q */ { @@ -1544,54 +1544,54 @@ void return_statement() /* q */ { { []() -> SV { return nullptr; } /* q1 */; // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return {}; } /* q1 */; + // CHECK-FIXES: []() -> SV { return {}; } /* q1 */; []() -> SV { return (nullptr); } /* q2 */; // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return {}; } /* q2 */; + // CHECK-FIXES: []() -> SV { return {}; } /* q2 */; []() -> SV { return {nullptr}; } /* q3 */; // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return {}; } /* q3 */; + // CHECK-FIXES: []() -> SV { return {}; } /* q3 */; []() -> SV { return {(nullptr)}; } /* q4 */; // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return {}; } /* q4 */; + // CHECK-FIXES: []() -> SV { return {}; } /* q4 */; []() -> SV { return {{nullptr}}; } /* q5 */; // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return {}; } /* q5 */; + // CHECK-FIXES: []() -> SV { return {}; } /* q5 */; []() -> SV { return {{(nullptr)}}; } /* q6 */; // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return {}; } /* q6 */; + // CHECK-FIXES: []() -> SV { return {}; } /* q6 */; []() -> SV { return {{}}; } /* q7 */; // Default `const CharT*` // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return {}; } /* q7 */; + // CHECK-FIXES: []() -> SV { return {}; } /* q7 */; } // Return Statement With Temporary { []() -> SV { return SV(nullptr); } /* q8 */; // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return SV(); } /* q8 */; + // CHECK-FIXES: []() -> SV { return SV(); } /* q8 */; []() -> SV { return SV{nullptr}; } /* q9 */; // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return SV{}; } /* q9 */; + // CHECK-FIXES: []() -> SV { return SV{}; } /* q9 */; []() -> SV { return (SV) nullptr; } /* q10 */; // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return (SV) {}; } /* q10 */; + // CHECK-FIXES: []() -> SV { return (SV) {}; } /* q10 */; []() -> SV { return (SV){nullptr}; } /* q11 */; // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: constructing{{.*}}default - // CHECK-FIXES: {{^}} []() -> SV { return (SV){}; } /* q11 */; + // CHECK-FIXES: []() -> SV { return (SV){}; } /* q11 */; []() -> SV { return static_cast(nullptr); } /* q12 */; // CHECK-MESSAGES: :[[@LINE-1]]:41: warning: casting{{.*}}empty string - // CHECK-FIXES: {{^}} []() -> SV { return static_cast(""); } /* q12 */; + // CHECK-FIXES: []() -> SV { return static_cast(""); } /* q12 */; } } @@ -1600,13 +1600,13 @@ void constructor_invocation() /* r */ { explicit AcceptsSV(std::string_view) {} } r1(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: passing{{.*}}empty string - // CHECK-FIXES: {{^}} } r1(""); + // CHECK-FIXES: } r1(""); (void)(AcceptsSV{nullptr}) /* r2 */; // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: passing{{.*}}empty string - // CHECK-FIXES: {{^}} (void)(AcceptsSV{""}) /* r2 */; + // CHECK-FIXES: (void)(AcceptsSV{""}) /* r2 */; AcceptsSV r3{nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: passing{{.*}}empty string - // CHECK-FIXES: {{^}} AcceptsSV r3{""}; + // CHECK-FIXES: AcceptsSV r3{""}; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon.cpp index 4f9f4c5db659e..8d87fe00c3e4c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon.cpp @@ -35,7 +35,7 @@ void fail2() if(x == 5); nop(); // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: potentially unintended semicolon [bugprone-suspicious-semicolon] - // CHECK-FIXES: if(x == 5){{$}} + // CHECK-FIXES: if(x == 5) } void fail3() @@ -45,7 +45,7 @@ void fail3() nop(); } // CHECK-MESSAGES: :[[@LINE-4]]:11: warning: potentially unintended semicolon - // CHECK-FIXES: if(x < 5){{$}} + // CHECK-FIXES: if(x < 5) } void correct4() @@ -65,7 +65,7 @@ void fail4() for(int i = 0; i < x; ++i); nop(); // CHECK-MESSAGES: :[[@LINE-2]]:28: warning: potentially unintended semicolon - // CHECK-FIXES: for(int i = 0; i < x; ++i){{$}} + // CHECK-FIXES: for(int i = 0; i < x; ++i) } void fail5() @@ -73,7 +73,7 @@ void fail5() if(x % 5 == 1); nop(); // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: potentially unintended semicolon - // CHECK-FIXES: if(x % 5 == 1){{$}} + // CHECK-FIXES: if(x % 5 == 1) } void fail6() { @@ -82,7 +82,7 @@ void fail6() { } else if (a != 1); a = 2; // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: potentially unintended semicolon - // CHECK-FIXES: } else if (a != 1){{$}} + // CHECK-FIXES: } else if (a != 1) } void fail7() { diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp index 824431c1bf52f..6aa69642d39ed 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp @@ -1,5 +1,5 @@ // RUN: %check_clang_tidy %s cppcoreguidelines-init-variables -fix-errors %t -- -- -fno-delayed-template-parsing -fexceptions -// CHECK-FIXES: {{^}}#include +// CHECK-FIXES: #include // Ensure that function declarations are not changed. void some_func(int x, double d, bool b, const char *p); @@ -28,48 +28,48 @@ void template_test_function() { T t; int uninitialized; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: variable 'uninitialized' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} int uninitialized = 0;{{$}} + // CHECK-FIXES: int uninitialized = 0; } void init_unit_tests() { int x; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: variable 'x' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} int x = 0;{{$}} + // CHECK-FIXES: int x = 0; my_int_type myint; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: variable 'myint' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} my_int_type myint = 0;{{$}} + // CHECK-FIXES: my_int_type myint = 0; MACRO_INT macroint; // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: variable 'macroint' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} MACRO_INT macroint = 0;{{$}} + // CHECK-FIXES: MACRO_INT macroint = 0; FULL_DECLARATION(); int x0 = 1, x1, x2 = 2; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: variable 'x1' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} int x0 = 1, x1 = 0, x2 = 2;{{$}} + // CHECK-FIXES: int x0 = 1, x1 = 0, x2 = 2; int y0, y1 = 1, y2; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: variable 'y0' is not initialized [cppcoreguidelines-init-variables] // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: variable 'y2' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} int y0 = 0, y1 = 1, y2 = 0;{{$}} + // CHECK-FIXES: int y0 = 0, y1 = 1, y2 = 0; int hasval = 42; float f; // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: variable 'f' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} float f = NAN;{{$}} + // CHECK-FIXES: float f = NAN; float fval = 85.0; double d; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: variable 'd' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} double d = NAN;{{$}} + // CHECK-FIXES: double d = NAN; double dval = 99.0; bool b; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: variable 'b' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} bool b = false;{{$}} + // CHECK-FIXES: bool b = false; bool bval = true; const char *ptr; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: variable 'ptr' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} const char *ptr = nullptr;{{$}} + // CHECK-FIXES: const char *ptr = nullptr; const char *ptrval = "a string"; UnusedStruct u; @@ -128,11 +128,11 @@ void uninitialized_enum() { void test_clang_diagnostic_error() { int a; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: variable 'a' is not initialized [cppcoreguidelines-init-variables] - // CHECK-FIXES: {{^}} int a = 0;{{$}} + // CHECK-FIXES: int a = 0; UnknownType b; // CHECK-MESSAGES: :[[@LINE-1]]:3: error: unknown type name 'UnknownType' [clang-diagnostic-error] - // CHECK-FIXES-NOT: {{^}} UnknownType b = 0;{{$}} + // CHECK-FIXES-NOT: UnknownType b = 0; } namespace gh112089 { diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/readability-namespace-comments.cpp b/clang-tools-extra/test/clang-tidy/checkers/google/readability-namespace-comments.cpp index 963449a213e53..d555b878ae4c0 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/google/readability-namespace-comments.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/google/readability-namespace-comments.cpp @@ -75,7 +75,7 @@ void h(); // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: anonymous namespace not terminated with // CHECK-MESSAGES: :[[@LINE-10]]:26: note: anonymous namespace starts here } -// CHECK-FIXES: } // namespace{{$}} +// CHECK-FIXES: } // namespace namespace [[]] { void hh(); @@ -89,7 +89,7 @@ void hh(); // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: anonymous namespace not terminated with // CHECK-MESSAGES: :[[@LINE-10]]:16: note: anonymous namespace starts here } -// CHECK-FIXES: } // namespace{{$}} +// CHECK-FIXES: } // namespace namespace short1 { namespace short2 { diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner-wrong-config.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner-wrong-config.cpp index 11ce59f3a4ce9..fdcb811707241 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner-wrong-config.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner-wrong-config.cpp @@ -7,4 +7,4 @@ // CHECK-MESSAGES: warning: The check 'misc-include-cleaner' will not perform any analysis because 'UnusedIncludes' and 'MissingIncludes' are both false. [clang-tidy-config] #include "bar.h" -// CHECK-FIXES-NOT: {{^}}#include "baz.h"{{$}} +// CHECK-FIXES-NOT: #include "baz.h" diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp index e10ac3f46e2e9..3db0efaa73244 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp @@ -1,10 +1,10 @@ // RUN: %check_clang_tidy %s misc-include-cleaner %t -- -- -I%S/Inputs -isystem%S/Inputs/system #include "bar.h" -// CHECK-FIXES: {{^}}#include "baz.h"{{$}} +// CHECK-FIXES: #include "baz.h" #include "foo.h" // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: included header foo.h is not used directly [misc-include-cleaner] // CHECK-FIXES: {{^}} -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: included header vector.h is not used directly [misc-include-cleaner] // CHECK-FIXES: {{^}} diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/redundant-expression.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/redundant-expression.cpp index 95d8ecb15a4f1..4ff0ba867ebb9 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/redundant-expression.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/redundant-expression.cpp @@ -999,21 +999,21 @@ int TestOperatorConfusion(int X, int Y, long Z) int K = !(1 | 2 | 4); // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: ineffective logical negation operator used; did you mean '~'? - // CHECK-FIXES: {{^}} int K = ~(1 | 2 | 4);{{$}} + // CHECK-FIXES: int K = ~(1 | 2 | 4); K = !(FLAG1 & FLAG2 & FLAG3); // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: ineffective logical negation operator - // CHECK-FIXES: {{^}} K = ~(FLAG1 & FLAG2 & FLAG3);{{$}} + // CHECK-FIXES: K = ~(FLAG1 & FLAG2 & FLAG3); K = !(3 | 4); // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: ineffective logical negation operator - // CHECK-FIXES: {{^}} K = ~(3 | 4);{{$}} + // CHECK-FIXES: K = ~(3 | 4); int NotFlags = !FLAGS; // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: ineffective logical negation operator - // CHECK-FIXES: {{^}} int NotFlags = ~FLAGS;{{$}} + // CHECK-FIXES: int NotFlags = ~FLAGS; NotFlags = NOTFLAGS; // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: ineffective logical negation operator return !(1 | 2 | 4); // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: ineffective logical negation operator - // CHECK-FIXES: {{^}} return ~(1 | 2 | 4);{{$}} + // CHECK-FIXES: return ~(1 | 2 | 4); } template diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-strict.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-strict.cpp index 319cefa1c68f1..56d1306c3633a 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-strict.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-strict.cpp @@ -5,14 +5,14 @@ namespace strict_mode { void f(int foo) {} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'foo' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void f(int /*foo*/) {}{{$}} +// CHECK-FIXES: void f(int /*foo*/) {} class E { int i; public: E(int j) {} // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'j' is unused -// CHECK-FIXES: {{^}} E(int /*j*/) {}{{$}} +// CHECK-FIXES: E(int /*j*/) {} }; class F { int i; @@ -20,7 +20,7 @@ class F { public: F(int j) : i() {} // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'j' is unused -// CHECK-FIXES: {{^}} F(int /*j*/) : i() {}{{$}} +// CHECK-FIXES: F(int /*j*/) : i() {} }; // Do not warn on naked functions. diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.c b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.c index e2f501c708f01..994dfa1c0486f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.c +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.c @@ -4,14 +4,14 @@ // ============= void a(int i) {;} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void a(int i) {;}{{$}} +// CHECK-FIXES: void a(int i) {;} #if __STDC_VERSION__ < 202311L static void b(); // In C before C23, forward declarations can leave out parameters. #endif static void b(int i) {;} // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}static void b() {;}{{$}} +// CHECK-FIXES: static void b() {;} // Unchanged cases // =============== diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp index c963cb5b21940..4baf8394c2ac3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp @@ -11,36 +11,36 @@ // ============= void a(int i) {;} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void a(int /*i*/) {;}{{$}} +// CHECK-FIXES: void a(int /*i*/) {;} void b(int i = 1) {;} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void b(int /*i*/ = 1) {;}{{$}} +// CHECK-FIXES: void b(int /*i*/ = 1) {;} void c(int *i) {;} // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void c(int * /*i*/) {;}{{$}} +// CHECK-FIXES: void c(int * /*i*/) {;} void d(int i[]) {;} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void d(int /*i*/[]) {;}{{$}} +// CHECK-FIXES: void d(int /*i*/[]) {;} void e(int i[1]) {;} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void e(int /*i*/[1]) {;}{{$}} +// CHECK-FIXES: void e(int /*i*/[1]) {;} void f(void (*fn)()) {;} // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: parameter 'fn' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}void f(void (* /*fn*/)()) {;}{{$}} +// CHECK-FIXES: void f(void (* /*fn*/)()) {;} int *k([[clang::lifetimebound]] int *i) { return nullptr; } // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}int *k({{\[\[clang::lifetimebound\]\]}} int * /*i*/) { return nullptr; }{{$}} +// CHECK-FIXES: int *k({{\[\[clang::lifetimebound\]\]}} int * /*i*/) { return nullptr; } #define ATTR_BEFORE(x) [[clang::lifetimebound]] x int* m(ATTR_BEFORE(const int *i)) { return nullptr; } // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}int* m(ATTR_BEFORE(const int * /*i*/)) { return nullptr; }{{$}} +// CHECK-FIXES: int* m(ATTR_BEFORE(const int * /*i*/)) { return nullptr; } #undef ATTR_BEFORE // Unchanged cases @@ -64,44 +64,44 @@ static bool static_var = useLambda([] (int a) { return a; }); // Remove parameters of local functions // ==================================== static void staticFunctionA(int i); -// CHECK-FIXES: {{^}}static void staticFunctionA(); +// CHECK-FIXES: static void staticFunctionA(); static void staticFunctionA(int i) {;} // CHECK-MESSAGES: :[[@LINE-1]]:33: warning -// CHECK-FIXES: {{^}}static void staticFunctionA() +// CHECK-FIXES: static void staticFunctionA() static void staticFunctionB(int i, int j) { (void)i; } // CHECK-MESSAGES: :[[@LINE-1]]:40: warning -// CHECK-FIXES: {{^}}static void staticFunctionB(int i) +// CHECK-FIXES: static void staticFunctionB(int i) static void staticFunctionC(int i, int j) { (void)j; } // CHECK-MESSAGES: :[[@LINE-1]]:33: warning -// CHECK-FIXES: {{^}}static void staticFunctionC(int j) +// CHECK-FIXES: static void staticFunctionC(int j) static void staticFunctionD(int i, int j, int k) { (void)i; (void)k; } // CHECK-MESSAGES: :[[@LINE-1]]:40: warning -// CHECK-FIXES: {{^}}static void staticFunctionD(int i, int k) +// CHECK-FIXES: static void staticFunctionD(int i, int k) static void staticFunctionE(int i = 4) {;} // CHECK-MESSAGES: :[[@LINE-1]]:33: warning -// CHECK-FIXES: {{^}}static void staticFunctionE() +// CHECK-FIXES: static void staticFunctionE() static void staticFunctionF(int i = 4); -// CHECK-FIXES: {{^}}static void staticFunctionF(); +// CHECK-FIXES: static void staticFunctionF(); static void staticFunctionF(int i) {;} // CHECK-MESSAGES: :[[@LINE-1]]:33: warning -// CHECK-FIXES: {{^}}static void staticFunctionF() +// CHECK-FIXES: static void staticFunctionF() static void staticFunctionG(int i[]); -// CHECK-FIXES: {{^}}static void staticFunctionG(); +// CHECK-FIXES: static void staticFunctionG(); static void staticFunctionG(int i[]) {;} // CHECK-MESSAGES: :[[@LINE-1]]:33: warning -// CHECK-FIXES: {{^}}static void staticFunctionG() +// CHECK-FIXES: static void staticFunctionG() static void staticFunctionH(void (*fn)()); -// CHECK-FIXES: {{^}}static void staticFunctionH(); +// CHECK-FIXES: static void staticFunctionH(); static void staticFunctionH(void (*fn)()) {;} // CHECK-MESSAGES: :[[@LINE-1]]:36: warning -// CHECK-FIXES: {{^}}static void staticFunctionH() +// CHECK-FIXES: static void staticFunctionH() static void someCallSites() { staticFunctionA(1); @@ -136,12 +136,12 @@ static void someCallSites() { // ======================================================= static int variableWithLongName1(int LongName1, int LongName2) { // CHECK-MESSAGES: :[[@LINE-1]]:53: warning: parameter 'LongName2' is unused -// CHECK-FIXES: {{^}}static int variableWithLongName1(int LongName1) { +// CHECK-FIXES: static int variableWithLongName1(int LongName1) { return LongName1; } static int variableWithLongName2(int LongName1, int LongName2) { // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: parameter 'LongName1' is unused -// CHECK-FIXES: {{^}}static int variableWithLongName2(int LongName2) { +// CHECK-FIXES: static int variableWithLongName2(int LongName2) { return LongName2; } static void someLongNameCallSites() { @@ -225,12 +225,12 @@ template void someFunctionTemplate(T b, T e) { (void)b; (void)e; } template void someFunctionTemplateOneUnusedParam(T b, T e) { (void)e; } // CHECK-MESSAGES: :[[@LINE-1]]:65: warning -// CHECK-FIXES: {{^}}template void someFunctionTemplateOneUnusedParam(T /*b*/, T e) { (void)e; } +// CHECK-FIXES: template void someFunctionTemplateOneUnusedParam(T /*b*/, T e) { (void)e; } template void someFunctionTemplateAllUnusedParams(T b, T e) {;} // CHECK-MESSAGES: :[[@LINE-1]]:66: warning // CHECK-MESSAGES: :[[@LINE-2]]:71: warning -// CHECK-FIXES: {{^}}template void someFunctionTemplateAllUnusedParams(T /*b*/, T /*e*/) {;} +// CHECK-FIXES: template void someFunctionTemplateAllUnusedParams(T /*b*/, T /*e*/) {;} static void dontGetConfusedByParametersInFunctionTypes() { void (*F)(int i); } @@ -244,7 +244,7 @@ namespace { struct a { void b(int c) {;} // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: parameter 'c' is unused -// CHECK-FIXES: {{^}} void b() {;}{{$}} +// CHECK-FIXES: void b() {;} }; template class d { @@ -262,7 +262,7 @@ void f2(int foo2) { } void f3(int foo3) {;} // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: parameter 'foo3' is unused -// CHECK-FIXES: {{^}}void f3(int /*foo3*/) {;}{{$}} +// CHECK-FIXES: void f3(int /*foo3*/) {;} class E { int i; @@ -277,7 +277,7 @@ class F { // Constructor initializer counts as a non-empty body. F(int j) : i() {} // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'j' is unused -// CHECK-FIXES: {{^}} F(int /*j*/) : i() {}{{$}} +// CHECK-FIXES: F(int /*j*/) : i() {} }; class A { @@ -289,7 +289,7 @@ class B : public A { public: B(int i) : A() {} // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'i' is unused -// CHECK-FIXES: {{^}} B(int /*i*/) : A() {}{{$}} +// CHECK-FIXES: B(int /*i*/) : A() {} }; } // namespace strict_mode_off @@ -298,7 +298,7 @@ using fn = void(int); void f(fn *); void test() { // CHECK-MESSAGES: :[[@LINE+2]]:12: warning: parameter 'I' is unused - // CHECK-FIXES: {{^}} f([](int /*I*/) { + // CHECK-FIXES: f([](int /*I*/) { f([](int I) { return; }); } } // namespace lambda diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-cxx17.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-cxx17.cpp index 69e9cf7e3d3f7..ac11218ec82a8 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-cxx17.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-cxx17.cpp @@ -22,7 +22,7 @@ using ns::Bar; using ns::Foo; using ns::Unused; // Unused // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: using decl 'Unused' is unused -// CHECK-FIXES: {{^}}// Unused +// CHECK-FIXES: // Unused void f() { Foo(123); diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx03.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx03.cpp index f01d6a677e27b..b02dfd1ce976f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx03.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx03.cpp @@ -2,69 +2,69 @@ #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include // Headers that have no effect in C++; remove them #include // // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// {{$}} +// CHECK-FIXES: // #include // // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// {{$}} +// CHECK-FIXES: // #include // // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// {{$}} +// CHECK-FIXES: // // Headers deprecated since C++11: expect no diagnostics. #include @@ -76,69 +76,69 @@ #include "assert.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "complex.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "ctype.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "errno.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "float.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "limits.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "locale.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "math.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "setjmp.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "signal.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stdarg.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stddef.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stdio.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stdlib.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "string.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "time.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "wchar.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "wctype.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead -// CHECK-FIXES: {{^}}#include +// CHECK-FIXES: #include // Headers that have no effect in C++; remove them #include "stdalign.h" // "stdalign.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// "stdalign.h"{{$}} +// CHECK-FIXES: // "stdalign.h" #include "stdbool.h" // "stdbool.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// "stdbool.h"{{$}} +// CHECK-FIXES: // "stdbool.h" #include "iso646.h" // "iso646.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// "iso646.h"{{$}} +// CHECK-FIXES: // "iso646.h" // Headers deprecated since C++11; expect no diagnostics #include "fenv.h" diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx11.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx11.cpp index 29c5dc4eb9762..99ef506276a66 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx11.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/deprecated-headers-cxx11.cpp @@ -2,162 +2,162 @@ #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead -// CHECK-FIXES: {{^}}#include +// CHECK-FIXES: #include // Headers that have no effect in C++; remove them #include // // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// {{$}} +// CHECK-FIXES: // #include // // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// {{$}} +// CHECK-FIXES: // #include // // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// {{$}} +// CHECK-FIXES: // #include "assert.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "complex.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "ctype.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "errno.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "fenv.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "float.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "inttypes.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "limits.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "locale.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "math.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "setjmp.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "signal.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stdarg.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stddef.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stdint.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stdio.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "stdlib.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "string.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "tgmath.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "time.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "uchar.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "wchar.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-FIXES: {{^}}#include {{$}} +// CHECK-FIXES: #include #include "wctype.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead -// CHECK-FIXES: {{^}}#include +// CHECK-FIXES: #include // Headers that have no effect in C++; remove them #include "stdalign.h" // "stdalign.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// "stdalign.h"{{$}} +// CHECK-FIXES: // "stdalign.h" #include "stdbool.h" // "stdbool.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// "stdbool.h"{{$}} +// CHECK-FIXES: // "stdbool.h" #include "iso646.h" // "iso646.h" // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it -// CHECK-FIXES: {{^}}// "iso646.h"{{$}} +// CHECK-FIXES: // "iso646.h" diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/raw-string-literal.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/raw-string-literal.cpp index 5856b8882574a..3a986650d8d3d 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/raw-string-literal.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/raw-string-literal.cpp @@ -2,7 +2,7 @@ char const *const BackSlash("goink\\frob"); // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: escaped string literal can be written as a raw string literal [modernize-raw-string-literal] -// CHECK-FIXES: {{^}}char const *const BackSlash(R"(goink\frob)");{{$}} +// CHECK-FIXES: char const *const BackSlash(R"(goink\frob)"); char const *const PlainLiteral("plain literal"); @@ -41,7 +41,7 @@ char const *const Us("goink\\\037"); char const *const HexNonPrintable("\\\x03"); char const *const Delete("\\\177"); char const *const MultibyteSnowman("\xE2\x98\x83"); -// CHECK-FIXES: {{^}}char const *const MultibyteSnowman("\xE2\x98\x83");{{$}} +// CHECK-FIXES: char const *const MultibyteSnowman("\xE2\x98\x83"); char const *const TrailingSpace("A line \\with space. \n"); char const *const TrailingNewLine("A single \\line.\n"); @@ -59,39 +59,39 @@ wchar_t const *const WideRawLiteral(LR"(foobie\\bletch)"); char const *const SingleQuote("goink\'frob"); // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: {{.*}} can be written as a raw string literal -// CHECK-XFIXES: {{^}}char const *const SingleQuote(R"(goink'frob)");{{$}} +// CHECK-XFIXES: char const *const SingleQuote(R"(goink'frob)"); char const *const DoubleQuote("goink\"frob"); // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const DoubleQuote(R"(goink"frob)");{{$}} +// CHECK-FIXES: char const *const DoubleQuote(R"(goink"frob)"); char const *const QuestionMark("goink\?frob"); // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const QuestionMark(R"(goink?frob)");{{$}} +// CHECK-FIXES: char const *const QuestionMark(R"(goink?frob)"); char const *const RegEx("goink\\(one|two\\)\\\\\\?.*\\nfrob"); // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const RegEx(R"(goink\(one|two\)\\\?.*\nfrob)");{{$}} +// CHECK-FIXES: char const *const RegEx(R"(goink\(one|two\)\\\?.*\nfrob)"); char const *const Path("C:\\Program Files\\Vendor\\Application\\Application.exe"); // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const Path(R"(C:\Program Files\Vendor\Application\Application.exe)");{{$}} +// CHECK-FIXES: char const *const Path(R"(C:\Program Files\Vendor\Application\Application.exe)"); char const *const ContainsSentinel("who\\ops)\""); // CHECK-MESSAGES: :[[@LINE-1]]:36: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const ContainsSentinel(R"lit(who\ops)")lit");{{$}} +// CHECK-FIXES: char const *const ContainsSentinel(R"lit(who\ops)")lit"); char const *const ContainsDelim("whoops)\")lit\""); // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const ContainsDelim(R"lit1(whoops)")lit")lit1");{{$}} +// CHECK-FIXES: char const *const ContainsDelim(R"lit1(whoops)")lit")lit1"); char const *const OctalPrintable("\100\\"); // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const OctalPrintable(R"(@\)");{{$}} +// CHECK-FIXES: char const *const OctalPrintable(R"(@\)"); char const *const HexPrintable("\x40\\"); // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}char const *const HexPrintable(R"(@\)");{{$}} +// CHECK-FIXES: char const *const HexPrintable(R"(@\)"); char const *const prettyFunction(__PRETTY_FUNCTION__); char const *const function(__FUNCTION__); @@ -111,23 +111,23 @@ template void fn(char const *const Arg) { char const *const Str("foo\\bar"); // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: {{.*}} can be written as a raw string literal - // CHECK-FIXES: {{^}} char const *const Str(R"(foo\bar)");{{$}} + // CHECK-FIXES: char const *const Str(R"(foo\bar)"); } template <> void fn(char const *const Arg) { char const *const Str("foo\\bar"); // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: {{.*}} can be written as a raw string literal - // CHECK-FIXES: {{^}} char const *const Str(R"(foo\bar)");{{$}} + // CHECK-FIXES: char const *const Str(R"(foo\bar)"); } void callFn() { fn("foo\\bar"); // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} can be written as a raw string literal - // CHECK-FIXES: {{^}} fn(R"(foo\bar)");{{$}} + // CHECK-FIXES: fn(R"(foo\bar)"); fn("foo\\bar"); // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}} can be written as a raw string literal - // CHECK-FIXES: {{^}} fn(R"(foo\bar)");{{$}} + // CHECK-FIXES: fn(R"(foo\bar)"); } namespace std { @@ -140,5 +140,5 @@ namespace gh97243 { using namespace std::ud; auto UserDefinedLiteral = "foo\\bar"_abc; // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: {{.*}} can be written as a raw string literal -// CHECK-FIXES: {{^}}auto UserDefinedLiteral = R"(foo\bar)"_abc; +// CHECK-FIXES: auto UserDefinedLiteral = R"(foo\bar)"_abc; } // namespace gh97243 diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg-delayed.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg-delayed.cpp index dd887758819eb..4e05ada1d2992 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg-delayed.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg-delayed.cpp @@ -2,7 +2,7 @@ int foo(void) { // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant void argument list in function definition [modernize-redundant-void-arg] -// CHECK-FIXES: {{^}}int foo() {{{$}} +// CHECK-FIXES: int foo() { return 0; } @@ -10,7 +10,7 @@ template struct MyFoo { int foo(void) { // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant void argument list in function definition [modernize-redundant-void-arg] -// CHECK-FIXES: {{^}} int foo() {{{$}} +// CHECK-FIXES: int foo() { return 0; } }; @@ -22,7 +22,7 @@ struct MyBar { // This declaration isn't instantiated and won't be parsed 'delayed-template-parsing'. int foo(void) { // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant void argument list in function definition [modernize-redundant-void-arg] -// CHECK-FIXES: {{^}} int foo() {{{$}} +// CHECK-FIXES: int foo() { return 0; } }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp index f43a910ba022c..935163bf31899 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp @@ -19,7 +19,7 @@ int j = 1; int foo(void) { // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant void argument list in function definition [modernize-redundant-void-arg] -// CHECK-FIXES: {{^}}int foo() {{{$}} +// CHECK-FIXES: int foo() { return 0; } @@ -32,23 +32,23 @@ typedef void my_void; int (*returns_fn_void_int(void))(void); // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: {{.*}} in function declaration // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: {{.*}} in function declaration -// CHECK-FIXES: {{^}}int (*returns_fn_void_int())();{{$}} +// CHECK-FIXES: int (*returns_fn_void_int())(); typedef int (*returns_fn_void_int_t(void))(void); // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: {{.*}} in typedef // CHECK-MESSAGES: :[[@LINE-2]]:44: warning: {{.*}} in typedef -// CHECK-FIXES: {{^}}typedef int (*returns_fn_void_int_t())();{{$}} +// CHECK-FIXES: typedef int (*returns_fn_void_int_t())(); // Should work for type aliases as well as typedef. using returns_fn_void_int_t2 = int (*(void))(void); // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: {{.*}} in type alias // CHECK-MESSAGES: :[[@LINE-2]]:46: warning: {{.*}} in type alias -// CHECK-FIXES: {{^}}using returns_fn_void_int_t2 = int (*())();{{$}} +// CHECK-FIXES: using returns_fn_void_int_t2 = int (*())(); int (*returns_fn_void_int(void))(void) { // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: {{.*}} in function definition // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: {{.*}} in function definition -// CHECK-FIXES: {{^}}int (*returns_fn_void_int())() {{{$}} +// CHECK-FIXES: int (*returns_fn_void_int())() { return nullptr; } @@ -58,25 +58,25 @@ void (*(*returns_fn_returns_fn_void_void(void))(void))(void); // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: {{.*}} in function declaration // CHECK-MESSAGES: :[[@LINE-2]]:49: warning: {{.*}} in function declaration // CHECK-MESSAGES: :[[@LINE-3]]:56: warning: {{.*}} in function declaration -// CHECK-FIXES: {{^}}void (*(*returns_fn_returns_fn_void_void())())();{{$}} +// CHECK-FIXES: void (*(*returns_fn_returns_fn_void_void())())(); typedef void (*(*returns_fn_returns_fn_void_void_t(void))(void))(void); // CHECK-MESSAGES: :[[@LINE-1]]:52: warning: {{.*}} in typedef // CHECK-MESSAGES: :[[@LINE-2]]:59: warning: {{.*}} in typedef // CHECK-MESSAGES: :[[@LINE-3]]:66: warning: {{.*}} in typedef -// CHECK-FIXES: {{^}}typedef void (*(*returns_fn_returns_fn_void_void_t())())();{{$}} +// CHECK-FIXES: typedef void (*(*returns_fn_returns_fn_void_void_t())())(); void (*(*returns_fn_returns_fn_void_void(void))(void))(void) { // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: {{.*}} in function definition // CHECK-MESSAGES: :[[@LINE-2]]:49: warning: {{.*}} in function definition // CHECK-MESSAGES: :[[@LINE-3]]:56: warning: {{.*}} in function definition -// CHECK-FIXES: {{^}}void (*(*returns_fn_returns_fn_void_void())())() {{{$}} +// CHECK-FIXES: void (*(*returns_fn_returns_fn_void_void())())() { return nullptr; } void bar(void) { // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: {{.*}} in function definition -// CHECK-FIXES: {{^}}void bar() {{{$}} +// CHECK-FIXES: void bar() { } void op_fn(int i) { @@ -103,13 +103,13 @@ class gronk { void (*f1)(void); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: {{.*}} in field declaration - // CHECK-FIXES: {{^ }}void (*f1)();{{$}} + // CHECK-FIXES: void (*f1)(); void (*op)(int i); void (gronk::*p1)(void); // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}} in field declaration - // CHECK-FIXES: {{^ }}void (gronk::*p1)();{{$}} + // CHECK-FIXES: void (gronk::*p1)(); int (gronk::*p_mi); @@ -119,13 +119,13 @@ class gronk { // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: {{.*}} in function declaration // CHECK-MESSAGES: :[[@LINE-2]]:51: warning: {{.*}} in function declaration // CHECK-MESSAGES: :[[@LINE-3]]:58: warning: {{.*}} in function declaration - // CHECK-FIXES: {{^}} void (*(*returns_fn_returns_fn_void_void())())();{{$}} + // CHECK-FIXES: void (*(*returns_fn_returns_fn_void_void())())(); void (*(*(gronk::*returns_fn_returns_fn_void_void_mem)(void))(void))(void); // CHECK-MESSAGES: :[[@LINE-1]]:58: warning: {{.*}} in field declaration // CHECK-MESSAGES: :[[@LINE-2]]:65: warning: {{.*}} in field declaration // CHECK-MESSAGES: :[[@LINE-3]]:72: warning: {{.*}} in field declaration - // CHECK-FIXES: {{^}} void (*(*(gronk::*returns_fn_returns_fn_void_void_mem)())())();{{$}} + // CHECK-FIXES: void (*(*(gronk::*returns_fn_returns_fn_void_void_mem)())())(); }; int i; @@ -138,35 +138,35 @@ double *pd; void (*f1)(void); // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: {{.*}} in variable declaration -// CHECK-FIXES: {{^}}void (*f1)();{{$}} +// CHECK-FIXES: void (*f1)(); void (*f2)(void) = nullptr; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (*f2)() = nullptr;{{$}} +// CHECK-FIXES: void (*f2)() = nullptr; void (*f2b)(void)(nullptr); // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (*f2b)()(nullptr);{{$}} +// CHECK-FIXES: void (*f2b)()(nullptr); void (*f2c)(void){nullptr}; // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (*f2c)(){nullptr};{{$}} +// CHECK-FIXES: void (*f2c)(){nullptr}; void (*f2d)(void) = NULL; // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (*f2d)() = NULL;{{$}} +// CHECK-FIXES: void (*f2d)() = NULL; void (*f2e)(void)(NULL); // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (*f2e)()(NULL);{{$}} +// CHECK-FIXES: void (*f2e)()(NULL); void (*f2f)(void){NULL}; // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (*f2f)(){NULL};{{$}} +// CHECK-FIXES: void (*f2f)(){NULL}; void (*f3)(void) = bar; // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (*f3)() = bar;{{$}} +// CHECK-FIXES: void (*f3)() = bar; void (*o1)(int i); void (*o2)(int i) = nullptr; @@ -185,7 +185,7 @@ void (*fc)() = bar; typedef void (function_ptr)(void); // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: {{.*}} in typedef -// CHECK-FIXES: {{^}}typedef void (function_ptr)();{{$}} +// CHECK-FIXES: typedef void (function_ptr)(); // intentionally not LLVM style to check preservation of whitespace typedef void (function_ptr2) @@ -245,15 +245,15 @@ void void (gronk::*p1)(void); // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: {{.*}} in variable declaration -// CHECK-FIXES: {{^}}void (gronk::*p1)();{{$}} +// CHECK-FIXES: void (gronk::*p1)(); void (gronk::*p2)(void) = &gronk::foo; // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: {{.*}} in variable declaration with initializer -// CHECK-FIXES: {{^}}void (gronk::*p2)() = &gronk::foo;{{$}} +// CHECK-FIXES: void (gronk::*p2)() = &gronk::foo; typedef void (gronk::*member_function_ptr)(void); // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: {{.*}} in typedef -// CHECK-FIXES: {{^}}typedef void (gronk::*member_function_ptr)();{{$}} +// CHECK-FIXES: typedef void (gronk::*member_function_ptr)(); // intentionally not LLVM style to check preservation of whitespace typedef void (gronk::*member_function_ptr2) @@ -269,11 +269,11 @@ typedef void (gronk::*member_function_ptr2) void gronk::foo() { void (*f1)(void) = &::bar; // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}} in variable declaration with initializer - // CHECK-FIXES: {{^ }}void (*f1)() = &::bar;{{$}} + // CHECK-FIXES: void (*f1)() = &::bar; void (*f2)(void); // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}} in variable declaration - // CHECK-FIXES: {{^ }}void (*f2)();{{$}} + // CHECK-FIXES: void (*f2)(); // intentionally not LLVM style to check preservation of whitespace void (*f3) @@ -289,14 +289,14 @@ void gronk::foo() { void gronk::bar(void) { // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} in function definition -// CHECK-FIXES: {{^}}void gronk::bar() {{{$}} +// CHECK-FIXES: void gronk::bar() { void (gronk::*p3)(void) = &gronk::foo; // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}} in variable declaration with initializer - // CHECK-FIXES: {{^ }}void (gronk::*p3)() = &gronk::foo;{{$}} + // CHECK-FIXES: void (gronk::*p3)() = &gronk::foo; void (gronk::*p4)(void); // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}} in variable declaration - // CHECK-FIXES: {{^ }}void (gronk::*p4)();{{$}} + // CHECK-FIXES: void (gronk::*p4)(); // intentionally not LLVM style to check preservation of whitespace void (gronk::*p5) @@ -325,14 +325,14 @@ void gronk::bar2 gronk::gronk(void) // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}} in function definition -// CHECK-FIXES: {{^}}gronk::gronk(){{$}} +// CHECK-FIXES: gronk::gronk() : f1(nullptr), p1(nullptr) { } gronk::~gronk(void) { // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} in function definition -// CHECK-FIXES: {{^}}gronk::~gronk() {{{$}} +// CHECK-FIXES: gronk::~gronk() { } class nutter { @@ -342,21 +342,21 @@ class nutter { nutter::nutter(void) { // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: {{.*}} in function definition -// CHECK-FIXES: {{^}}nutter::nutter() {{{$}} +// CHECK-FIXES: nutter::nutter() { void (*f3)(void) = static_cast(0); // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}} in variable declaration with initializer // CHECK-MESSAGES: :[[@LINE-2]]:43: warning: {{.*}} in named cast - // CHECK-FIXES: void (*f3)() = static_cast(0);{{$}} + // CHECK-FIXES: void (*f3)() = static_cast(0); void (*f4)(void) = (void (*)(void)) 0; // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}} in variable declaration with initializer // CHECK-MESSAGES: :[[@LINE-2]]:32: warning: {{.*}} in cast expression - // CHECK-FIXES: void (*f4)() = (void (*)()) 0;{{$}} + // CHECK-FIXES: void (*f4)() = (void (*)()) 0; void (*f5)(void) = reinterpret_cast(0); // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}} in variable declaration with initializer // CHECK-MESSAGES: :[[@LINE-2]]:48: warning: {{.*}} in named cast - // CHECK-FIXES: void (*f5)() = reinterpret_cast(0);{{$}} + // CHECK-FIXES: void (*f5)() = reinterpret_cast(0); // intentionally not LLVM style to check preservation of whitespace void (*f6)(void) = static_cast void (*)(void) { return f1; }; // CHECK-MESSAGES: [[@LINE-1]]:27: warning: {{.*}} in lambda expression // CHECK-MESSAGES: [[@LINE-2]]:45: warning: {{.*}} in lambda expression - // CHECK-FIXES: {{^ }}auto void_returner = []() -> void (*)() { return f1; };{{$}} + // CHECK-FIXES: auto void_returner = []() -> void (*)() { return f1; }; } #define M(x) x diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-disallow-copy-and-assign-macro.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-disallow-copy-and-assign-macro.cpp index 45893c6a15d26..7b4c5d958b63d 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-disallow-copy-and-assign-macro.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-disallow-copy-and-assign-macro.cpp @@ -33,8 +33,8 @@ class TestClass1 { DISALLOW_COPY_AND_ASSIGN(TestClass1); }; // CHECK-MESSAGES-DEFAULT: :[[@LINE-2]]:3: warning: prefer deleting copy constructor and assignment operator over using macro 'DISALLOW_COPY_AND_ASSIGN' [modernize-replace-disallow-copy-and-assign-macro] -// CHECK-FIXES-DEFAULT: {{^}} TestClass1(const TestClass1 &) = delete;{{$}} -// CHECK-FIXES-DEFAULT-NEXT: {{^}} const TestClass1 &operator=(const TestClass1 &) = delete;{{$}} +// CHECK-FIXES-DEFAULT: TestClass1(const TestClass1 &) = delete; +// CHECK-FIXES-DEFAULT-NEXT: const TestClass1 &operator=(const TestClass1 &) = delete; #define MY_MACRO_NAME(TypeName) @@ -43,8 +43,8 @@ class TestClass2 { MY_MACRO_NAME(TestClass2); }; // CHECK-MESSAGES-DIFFERENT-NAME: :[[@LINE-2]]:3: warning: prefer deleting copy constructor and assignment operator over using macro 'MY_MACRO_NAME' [modernize-replace-disallow-copy-and-assign-macro] -// CHECK-FIXES-DIFFERENT-NAME: {{^}} TestClass2(const TestClass2 &) = delete;{{$}} -// CHECK-FIXES-DIFFERENT-NAME-NEXT: {{^}} const TestClass2 &operator=(const TestClass2 &) = delete;{{$}} +// CHECK-FIXES-DIFFERENT-NAME: TestClass2(const TestClass2 &) = delete; +// CHECK-FIXES-DIFFERENT-NAME-NEXT: const TestClass2 &operator=(const TestClass2 &) = delete; #define DISALLOW_COPY_AND_ASSIGN_FINALIZE(TypeName) \ TypeName(const TypeName &) = delete; \ @@ -58,8 +58,8 @@ class TestClass3 { DISALLOW_COPY_AND_ASSIGN_FINALIZE(TestClass3) }; // CHECK-MESSAGES-FINALIZE: :[[@LINE-2]]:3: warning: prefer deleting copy constructor and assignment operator over using macro 'DISALLOW_COPY_AND_ASSIGN_FINALIZE' [modernize-replace-disallow-copy-and-assign-macro] -// CHECK-FIXES-FINALIZE: {{^}} TestClass3(const TestClass3 &) = delete;{{$}} -// CHECK-FIXES-FINALIZE-NEXT: {{^}} const TestClass3 &operator=(const TestClass3 &) = delete;{{$}} +// CHECK-FIXES-FINALIZE: TestClass3(const TestClass3 &) = delete; +// CHECK-FIXES-FINALIZE-NEXT: const TestClass3 &operator=(const TestClass3 &) = delete; #define DISALLOW_COPY_AND_ASSIGN_MORE_AGUMENTS(A, B) diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-bool-literals.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-bool-literals.cpp index 30c10efabaef3..1acb3c3594b0d 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-bool-literals.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-bool-literals.cpp @@ -5,43 +5,43 @@ bool IntToTrue = 1; // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: converting integer literal to bool, use bool literal instead [modernize-use-bool-literals] -// CHECK-FIXES: {{^}}bool IntToTrue = true;{{$}} +// CHECK-FIXES: bool IntToTrue = true; bool IntToFalse(0); // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool IntToFalse(false);{{$}} +// CHECK-FIXES: bool IntToFalse(false); bool LongLongToTrue{0x1LL}; // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool LongLongToTrue{true};{{$}} +// CHECK-FIXES: bool LongLongToTrue{true}; bool ExplicitCStyleIntToFalse = (bool)0; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool ExplicitCStyleIntToFalse = false;{{$}} +// CHECK-FIXES: bool ExplicitCStyleIntToFalse = false; bool ExplicitFunctionalIntToFalse = bool(0); // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool ExplicitFunctionalIntToFalse = false;{{$}} +// CHECK-FIXES: bool ExplicitFunctionalIntToFalse = false; bool ExplicitStaticIntToFalse = static_cast(0); // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool ExplicitStaticIntToFalse = false;{{$}} +// CHECK-FIXES: bool ExplicitStaticIntToFalse = false; #define TRUE_MACRO 1 -// CHECK-FIXES: {{^}}#define TRUE_MACRO 1{{$}} +// CHECK-FIXES: #define TRUE_MACRO 1 bool MacroIntToTrue = TRUE_MACRO; // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool MacroIntToTrue = TRUE_MACRO;{{$}} +// CHECK-FIXES: bool MacroIntToTrue = TRUE_MACRO; #define FALSE_MACRO bool(0) -// CHECK-FIXES: {{^}}#define FALSE_MACRO bool(0){{$}} +// CHECK-FIXES: #define FALSE_MACRO bool(0) bool TrueBool = true; // OK bool FalseBool = bool(FALSE_MACRO); // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool FalseBool = bool(FALSE_MACRO);{{$}} +// CHECK-FIXES: bool FalseBool = bool(FALSE_MACRO); void boolFunction(bool bar) { @@ -52,58 +52,58 @@ char Character = 0; // OK unsigned long long LongInteger = 1; // OK #define MACRO_DEPENDENT_CAST(x) static_cast(x) -// CHECK-FIXES: {{^}}#define MACRO_DEPENDENT_CAST(x) static_cast(x){{$}} +// CHECK-FIXES: #define MACRO_DEPENDENT_CAST(x) static_cast(x) bool MacroDependentBool = MACRO_DEPENDENT_CAST(0); // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool MacroDependentBool = MACRO_DEPENDENT_CAST(0);{{$}} +// CHECK-FIXES: bool MacroDependentBool = MACRO_DEPENDENT_CAST(0); bool ManyMacrosDependent = MACRO_DEPENDENT_CAST(FALSE_MACRO); // CHECK-MESSAGES: :[[@LINE-1]]:49: warning: converting integer literal to bool -// CHECK-FIXES: {{^}}bool ManyMacrosDependent = MACRO_DEPENDENT_CAST(FALSE_MACRO);{{$}} +// CHECK-FIXES: bool ManyMacrosDependent = MACRO_DEPENDENT_CAST(FALSE_MACRO); class FooClass { public: FooClass() : JustBool(0) {} // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}FooClass() : JustBool(false) {}{{$}} + // CHECK-FIXES: FooClass() : JustBool(false) {} FooClass(int) : JustBool{0} {} // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}FooClass(int) : JustBool{false} {}{{$}} + // CHECK-FIXES: FooClass(int) : JustBool{false} {} private: bool JustBool; bool BoolWithBraces{0}; // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}bool BoolWithBraces{false};{{$}} + // CHECK-FIXES: bool BoolWithBraces{false}; bool BoolFromInt = 0; // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}bool BoolFromInt = false;{{$}} + // CHECK-FIXES: bool BoolFromInt = false; bool SimpleBool = true; // OK }; template void templateFunction(type) { type TemplateType = 0; - // CHECK-FIXES: {{^ *}}type TemplateType = 0;{{$}} + // CHECK-FIXES: type TemplateType = 0; } template void valueDependentTemplateFunction() { bool Boolean = c; - // CHECK-FIXES: {{^ *}}bool Boolean = c;{{$}} + // CHECK-FIXES: bool Boolean = c; } template void anotherTemplateFunction(type) { bool JustBool = 0; // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}bool JustBool = false;{{$}} + // CHECK-FIXES: bool JustBool = false; } int main() { boolFunction(1); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}boolFunction(true);{{$}} + // CHECK-FIXES: boolFunction(true); boolFunction(false); @@ -117,7 +117,7 @@ int main() { IntToTrue = 1; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}IntToTrue = true;{{$}} + // CHECK-FIXES: IntToTrue = true; } static int Value = 1; @@ -126,7 +126,7 @@ bool Function1() { bool Result = Value == 1 ? 1 : 0; // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: converting integer literal to bool // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}bool Result = Value == 1 ? true : false;{{$}} + // CHECK-FIXES: bool Result = Value == 1 ? true : false; return Result; } @@ -134,18 +134,18 @@ bool Function2() { return Value == 1 ? 1 : 0; // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: converting integer literal to bool // CHECK-MESSAGES: :[[@LINE-2]]:27: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}return Value == 1 ? true : false;{{$}} + // CHECK-FIXES: return Value == 1 ? true : false; } void foo() { bool Result; Result = Value == 1 ? true : 0; // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}Result = Value == 1 ? true : false;{{$}} + // CHECK-FIXES: Result = Value == 1 ? true : false; Result = Value == 1 ? false : bool(0); // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}Result = Value == 1 ? false : false;{{$}} + // CHECK-FIXES: Result = Value == 1 ? false : false; Result = Value == 1 ? (bool)0 : false; // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: converting integer literal to bool - // CHECK-FIXES: {{^ *}}Result = Value == 1 ? false : false;{{$}} + // CHECK-FIXES: Result = Value == 1 ? false : false; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints-first-greatergreater.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints-first-greatergreater.cpp index c3b2c184364a7..b92e9093c97ee 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints-first-greatergreater.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints-first-greatergreater.cpp @@ -19,4 +19,4 @@ template > void first_greatergreater_is_enable_if() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void first_greatergreater_is_enable_if() requires T::some_value {{{$}} +// CHECK-FIXES: void first_greatergreater_is_enable_if() requires T::some_value { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints.cpp index 90131c3d86920..ecae36165e05e 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-constraints.cpp @@ -33,28 +33,28 @@ typename std::enable_if::type basic() { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}Obj basic() requires T::some_value {{{$}} +// CHECK-FIXES: Obj basic() requires T::some_value { template std::enable_if_t basic_t() { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}Obj basic_t() requires T::some_value {{{$}} +// CHECK-FIXES: Obj basic_t() requires T::some_value { template auto basic_trailing() -> typename std::enable_if::type { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}auto basic_trailing() -> Obj requires T::some_value {{{$}} +// CHECK-FIXES: auto basic_trailing() -> Obj requires T::some_value { template typename std::enable_if::type existing_constraint() requires (T::another_value) { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}typename std::enable_if::type existing_constraint() requires (T::another_value) {{{$}} +// CHECK-FIXES: typename std::enable_if::type existing_constraint() requires (T::another_value) { template typename std::enable_if::type decl_without_def(); @@ -79,32 +79,32 @@ typename std::enable_if::type* pointer_of_enable_if() { return nullptr; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}int* pointer_of_enable_if() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: int* pointer_of_enable_if() requires T::some_value { template std::enable_if_t* pointer_of_enable_if_t() { return nullptr; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}int* pointer_of_enable_if_t() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: int* pointer_of_enable_if_t() requires T::some_value { template const std::enable_if_t* const_pointer_of_enable_if_t() { return nullptr; } // CHECK-MESSAGES: :[[@LINE-3]]:7: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}const int* const_pointer_of_enable_if_t() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: const int* const_pointer_of_enable_if_t() requires T::some_value { template std::enable_if_t const * const_pointer_of_enable_if_t2() { return nullptr; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}int const * const_pointer_of_enable_if_t2() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: int const * const_pointer_of_enable_if_t2() requires T::some_value { template @@ -112,34 +112,34 @@ std::enable_if_t& reference_of_enable_if_t() { static int x; return x; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}int& reference_of_enable_if_t() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: int& reference_of_enable_if_t() requires T::some_value { template const std::enable_if_t& const_reference_of_enable_if_t() { static int x; return x; } // CHECK-MESSAGES: :[[@LINE-3]]:7: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}const int& const_reference_of_enable_if_t() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: const int& const_reference_of_enable_if_t() requires T::some_value { template typename std::enable_if::type enable_if_default_void() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void enable_if_default_void() requires T::some_value {{{$}} +// CHECK-FIXES: void enable_if_default_void() requires T::some_value { template std::enable_if_t enable_if_t_default_void() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void enable_if_t_default_void() requires T::some_value {{{$}} +// CHECK-FIXES: void enable_if_t_default_void() requires T::some_value { template std::enable_if_t* enable_if_t_default_void_pointer() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void* enable_if_t_default_void_pointer() requires T::some_value {{{$}} +// CHECK-FIXES: void* enable_if_t_default_void_pointer() requires T::some_value { namespace using_namespace_std { @@ -149,25 +149,25 @@ template typename enable_if::type with_typename() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void with_typename() requires T::some_value {{{$}} +// CHECK-FIXES: void with_typename() requires T::some_value { template enable_if_t with_t() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void with_t() requires T::some_value {{{$}} +// CHECK-FIXES: void with_t() requires T::some_value { template typename enable_if::type with_typename_and_type() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}int with_typename_and_type() requires T::some_value {{{$}} +// CHECK-FIXES: int with_typename_and_type() requires T::some_value { template enable_if_t with_t_and_type() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}int with_t_and_type() requires T::some_value {{{$}} +// CHECK-FIXES: int with_t_and_type() requires T::some_value { } // namespace using_namespace_std @@ -213,43 +213,43 @@ template std::enable_if_t::value> type_trait_value() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void type_trait_value() requires Traits::value {{{$}} +// CHECK-FIXES: void type_trait_value() requires Traits::value { template std::enable_if_t::member()> type_trait_member_call() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void type_trait_member_call() requires (Traits::member()) {{{$}} +// CHECK-FIXES: void type_trait_member_call() requires (Traits::member()) { template std::enable_if_t::value> negate() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void negate() requires (!Traits::value) {{{$}} +// CHECK-FIXES: void negate() requires (!Traits::value) { template std::enable_if_t::value1 && Traits::value2> conjunction() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void conjunction() requires (Traits::value1 && Traits::value2) {{{$}} +// CHECK-FIXES: void conjunction() requires (Traits::value1 && Traits::value2) { template std::enable_if_t::value1 || Traits::value2> disjunction() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void disjunction() requires (Traits::value1 || Traits::value2) {{{$}} +// CHECK-FIXES: void disjunction() requires (Traits::value1 || Traits::value2) { template std::enable_if_t::value1 && !Traits::value2> conjunction_with_negate() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void conjunction_with_negate() requires (Traits::value1 && !Traits::value2) {{{$}} +// CHECK-FIXES: void conjunction_with_negate() requires (Traits::value1 && !Traits::value2) { template std::enable_if_t::value1 == (Traits::value2 + 5)> complex_operators() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void complex_operators() requires (Traits::value1 == (Traits::value2 + 5)) {{{$}} +// CHECK-FIXES: void complex_operators() requires (Traits::value1 == (Traits::value2 + 5)) { } // namespace primary_expression_tests @@ -263,14 +263,14 @@ constexpr typename std::enable_if::type constexpr_decl() { return 10; } // CHECK-MESSAGES: :[[@LINE-3]]:11: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}constexpr int constexpr_decl() requires T::some_value {{{$}} +// CHECK-FIXES: constexpr int constexpr_decl() requires T::some_value { template static inline constexpr typename std::enable_if::type static_inline_constexpr_decl() { return 10; } // CHECK-MESSAGES: :[[@LINE-3]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}static inline constexpr int static_inline_constexpr_decl() requires T::some_value {{{$}} +// CHECK-FIXES: static inline constexpr int static_inline_constexpr_decl() requires T::some_value { template static @@ -279,16 +279,16 @@ static_decl() { return 10; } // CHECK-MESSAGES: :[[@LINE-4]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}static{{$}} -// CHECK-FIXES-NEXT: {{^}}int{{$}} -// CHECK-FIXES-NEXT: {{^}}static_decl() requires T::some_value {{{$}} +// CHECK-FIXES: static +// CHECK-FIXES-NEXT: int +// CHECK-FIXES-NEXT: static_decl() requires T::some_value { template constexpr /* comment */ typename std::enable_if::type constexpr_comment_decl() { return 10; } // CHECK-MESSAGES: :[[@LINE-3]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}constexpr /* comment */ int constexpr_comment_decl() requires T::some_value {{{$}} +// CHECK-FIXES: constexpr /* comment */ int constexpr_comment_decl() requires T::some_value { //////////////////////////////// @@ -302,45 +302,45 @@ struct AClass { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:10: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} static Obj static_method() requires T::some_value {{{$}} + // CHECK-FIXES: static Obj static_method() requires T::some_value { template typename std::enable_if::type member() { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} Obj member() requires T::some_value {{{$}} + // CHECK-FIXES: Obj member() requires T::some_value { template typename std::enable_if::type const_qualifier() const { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} Obj const_qualifier() const requires T::some_value {{{$}} + // CHECK-FIXES: Obj const_qualifier() const requires T::some_value { template typename std::enable_if::type rvalue_ref_qualifier() && { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} Obj rvalue_ref_qualifier() && requires T::some_value {{{$}} + // CHECK-FIXES: Obj rvalue_ref_qualifier() && requires T::some_value { template typename std::enable_if::type rvalue_ref_qualifier_comment() /* c1 */ && /* c2 */ { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} Obj rvalue_ref_qualifier_comment() /* c1 */ && /* c2 */ requires T::some_value {{{$}} + // CHECK-FIXES: Obj rvalue_ref_qualifier_comment() /* c1 */ && /* c2 */ requires T::some_value { template std::enable_if_t operator=(T&&) = delete; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} AClass& operator=(T&&) requires T::some_value = delete; + // CHECK-FIXES: AClass& operator=(T&&) requires T::some_value = delete; template std::enable_if_t operator=(ConsumeVariadic) noexcept(requires (T t) { t = 4; }) = delete; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} AClass& operator=(ConsumeVariadic) noexcept(requires (T t) { t = 4; }) requires T::some_value = delete; + // CHECK-FIXES: AClass& operator=(ConsumeVariadic) noexcept(requires (T t) { t = 4; }) requires T::some_value = delete; }; @@ -354,7 +354,7 @@ typename std::enable_if::type leading_comment() return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}Obj leading_comment() requires /* check1 */ T::some_value {{{$}} +// CHECK-FIXES: Obj leading_comment() requires /* check1 */ T::some_value { template typename std::enable_if::type body_on_next_line() @@ -362,22 +362,22 @@ typename std::enable_if::type body_on_next_line() return Obj{}; } // CHECK-MESSAGES: :[[@LINE-4]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}Obj body_on_next_line(){{$}} -// CHECK-FIXES-NEXT: {{^}}requires T::some_value {{{$}} +// CHECK-FIXES: Obj body_on_next_line() +// CHECK-FIXES-NEXT: requires T::some_value { template typename std::enable_if< /* check1 */ T::some_value, Obj>::type leading_comment_whitespace() { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}Obj leading_comment_whitespace() requires /* check1 */ T::some_value {{{$}} +// CHECK-FIXES: Obj leading_comment_whitespace() requires /* check1 */ T::some_value { template typename std::enable_if::type leading_and_trailing_comment() { return Obj{}; } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}Obj leading_and_trailing_comment() requires /* check1 */ T::some_value /* check2 */ {{{$}} +// CHECK-FIXES: Obj leading_and_trailing_comment() requires /* check1 */ T::some_value /* check2 */ { template typename std::enable_if typename std::enable_if :: type* pointer_of_enable_if_t_with_spaces() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}int* pointer_of_enable_if_t_with_spaces() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: int* pointer_of_enable_if_t_with_spaces() requires T::some_value { template typename std::enable_if :: /*c*/ type* pointer_of_enable_if_t_with_comment() { } // CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}int* pointer_of_enable_if_t_with_comment() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: int* pointer_of_enable_if_t_with_comment() requires T::some_value { template std::enable_if_t trailing_slash_slash_comment() { } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void trailing_slash_slash_comment() requires T::some_value // comment{{$}} -// CHECK-FIXES-NEXT: {{^}} {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void trailing_slash_slash_comment() requires T::some_value // comment +// CHECK-FIXES-NEXT: { } // namespace enable_if_in_return_type @@ -424,22 +424,22 @@ template ::type = 0> void basic() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void basic() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void basic() requires T::some_value { template = 0> void basic_t() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void basic_t() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void basic_t() requires T::some_value { template class U, class V, std::enable_if_t = 0> void basic_many_template_params() { } // CHECK-MESSAGES: :[[@LINE-3]]:61: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template class U, class V>{{$}} -// CHECK-FIXES-NEXT: {{^}}void basic_many_template_params() requires T::some_value {{{$}} +// CHECK-FIXES: template class U, class V> +// CHECK-FIXES-NEXT: void basic_many_template_params() requires T::some_value { template = 0> void no_dependent_type() { @@ -457,38 +457,37 @@ struct AClass : ABaseClass { void no_other_template_params() { } // CHECK-MESSAGES: :[[@LINE-3]]:13: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} {{$}} - // CHECK-FIXES-NEXT: {{^}} void no_other_template_params() requires T::some_value {{{$}} + // CHECK-FIXES: void no_other_template_params() requires T::some_value { template = 0> AClass() {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass() requires U::some_value {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass() requires U::some_value {} template = 0> AClass(int) : data(0) {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass(int) requires U::some_value : data(0) {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass(int) requires U::some_value : data(0) {} template = 0> AClass(int, int) : AClass(0) {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass(int, int) requires U::some_value : AClass(0) {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass(int, int) requires U::some_value : AClass(0) {} template = 0> AClass(int, int, int) : ABaseClass(0) {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass(int, int, int) requires U::some_value : ABaseClass(0) {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass(int, int, int) requires U::some_value : ABaseClass(0) {} template = 0> AClass(int, int, int, int) : data2(), data() {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass(int, int, int, int) requires U::some_value : data2(), data() {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass(int, int, int, int) requires U::some_value : data2(), data() {} int data; int data2; @@ -500,14 +499,14 @@ struct AClass2 : ABaseClass { template = 0> AClass2() {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass2() requires U::some_value {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass2() requires U::some_value {} template = 0> AClass2(int) : data2(0) {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass2(int) requires U::some_value : data2(0) {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass2(int) requires U::some_value : data2(0) {} int data = 10; int data2; @@ -518,16 +517,16 @@ template * = 0> void pointer_type() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void pointer_type() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void pointer_type() requires T::some_value { template * = nullptr> void param_on_newline() { } // CHECK-MESSAGES: :[[@LINE-3]]:11: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void param_on_newline() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void param_on_newline() requires T::some_value { template {{$}} -// CHECK-FIXES-NEXT: {{^}}void param_split_on_two_lines() requires ConsumeVariadic::value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void param_split_on_two_lines() requires ConsumeVariadic::value { template * = nullptr> void trailing_slash_slash_comment() { } // CHECK-MESSAGES: :[[@LINE-4]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void trailing_slash_slash_comment() requires T::some_value // comment{{$}} -// CHECK-FIXES-NEXT: {{^}} {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void trailing_slash_slash_comment() requires T::some_value // comment +// CHECK-FIXES-NEXT: { template * = nullptr, std::enable_if_t* = nullptr> void two_enable_ifs() { } // CHECK-MESSAGES: :[[@LINE-3]]:67: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template * = nullptr>{{$}} -// CHECK-FIXES-NEXT: {{^}}void two_enable_ifs() requires T::another_value {{{$}} +// CHECK-FIXES: template * = nullptr> +// CHECK-FIXES-NEXT: void two_enable_ifs() requires T::another_value { //////////////////////////////// // Negative tests @@ -584,16 +583,16 @@ void macro_entire_enable_if() { } // CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] // CHECK-MESSAGES: :[[@LINE-5]]:56: note: expanded from macro 'TEMPLATE_REQUIRES' -// CHECK-FIXES: {{^}}TEMPLATE_REQUIRES(U, U::some_value) -// CHECK-FIXES-NEXT: {{^}}void macro_entire_enable_if() {{{$}} +// CHECK-FIXES: TEMPLATE_REQUIRES(U, U::some_value) +// CHECK-FIXES-NEXT: void macro_entire_enable_if() { #define CONDITION U::some_value template = 0> void macro_condition() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void macro_condition() requires CONDITION {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void macro_condition() requires CONDITION { #undef CONDITION #define CONDITION !U::some_value @@ -601,8 +600,8 @@ template = 0> void macro_condition_not_primary() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void macro_condition_not_primary() requires (CONDITION) {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void macro_condition_not_primary() requires (CONDITION) { } // namespace enable_if_trailing_non_type_parameter @@ -617,22 +616,22 @@ template ::type> void basic() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void basic() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void basic() requires T::some_value { template > void basic_t() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void basic_t() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void basic_t() requires T::some_value { template class U, class V, typename = std::enable_if_t> void basic_many_template_params() { } // CHECK-MESSAGES: :[[@LINE-3]]:61: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template class U, class V>{{$}} -// CHECK-FIXES-NEXT: {{^}}void basic_many_template_params() requires T::some_value {{{$}} +// CHECK-FIXES: template class U, class V> +// CHECK-FIXES-NEXT: void basic_many_template_params() requires T::some_value { struct ABaseClass { ABaseClass(); @@ -645,32 +644,31 @@ struct AClass : ABaseClass { void no_other_template_params() { } // CHECK-MESSAGES: :[[@LINE-3]]:13: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} {{$}} - // CHECK-FIXES-NEXT: {{^}} void no_other_template_params() requires T::some_value {{{$}} + // CHECK-FIXES: void no_other_template_params() requires T::some_value { template > AClass() {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass() requires U::some_value {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass() requires U::some_value {} template > AClass(int) : data(0) {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass(int) requires U::some_value : data(0) {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass(int) requires U::some_value : data(0) {} template > AClass(int, int) : AClass(0) {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass(int, int) requires U::some_value : AClass(0) {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass(int, int) requires U::some_value : AClass(0) {} template > AClass(int, int, int) : ABaseClass(0) {} // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] - // CHECK-FIXES: {{^}} template {{$}} - // CHECK-FIXES-NEXT: {{^}} AClass(int, int, int) requires U::some_value : ABaseClass(0) {}{{$}} + // CHECK-FIXES: template + // CHECK-FIXES-NEXT: AClass(int, int, int) requires U::some_value : ABaseClass(0) {} int data; }; @@ -679,23 +677,23 @@ template *> void pointer_type() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void pointer_type() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void pointer_type() requires T::some_value { template &> void reference_type() { } // CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void reference_type() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void reference_type() requires T::some_value { template *> void param_on_newline() { } // CHECK-MESSAGES: :[[@LINE-3]]:11: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}template {{$}} -// CHECK-FIXES-NEXT: {{^}}void param_on_newline() requires T::some_value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void param_on_newline() requires T::some_value { template {{$}} -// CHECK-FIXES-NEXT: {{^}}void param_split_on_two_lines() requires ConsumeVariadic::value {{{$}} +// CHECK-FIXES: template +// CHECK-FIXES-NEXT: void param_split_on_two_lines() requires ConsumeVariadic::value { //////////////////////////////// @@ -776,12 +774,12 @@ using enable_if_t = typename enable_if::type; template typename nonstd::enable_if::value, void>::type nonstd_enable_if() {} // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void nonstd_enable_if() requires some_type_trait::value {}{{$}} +// CHECK-FIXES: void nonstd_enable_if() requires some_type_trait::value {} template nonstd::enable_if_t::value, void> nonstd_enable_if_t() {} // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void nonstd_enable_if_t() requires some_type_trait::value {}{{$}} +// CHECK-FIXES: void nonstd_enable_if_t() requires some_type_trait::value {} template <> nonstd::enable_if_t::value, void> nonstd_enable_if_t() {} @@ -790,12 +788,12 @@ nonstd::enable_if_t::value, void> nonstd_enable_if_t() template typename nonstd::enable_if::value>::type nonstd_enable_if_one_param() {} // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void nonstd_enable_if_one_param() requires some_type_trait::value {}{{$}} +// CHECK-FIXES: void nonstd_enable_if_one_param() requires some_type_trait::value {} template nonstd::enable_if_t::value> nonstd_enable_if_t_one_param() {} // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints] -// CHECK-FIXES: {{^}}void nonstd_enable_if_t_one_param() requires some_type_trait::value {}{{$}} +// CHECK-FIXES: void nonstd_enable_if_t_one_param() requires some_type_trait::value {} // No fix-its are offered for an enable_if with a different signature from the standard one. namespace boost { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init-assignment.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init-assignment.cpp index cf0df449f6de5..5a868e2fbe04b 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init-assignment.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init-assignment.cpp @@ -197,32 +197,32 @@ class ArrayValueInit { ArrayValueInit() : m_array() {} double m_array[1]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayValueInit() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[1] = {}; + // CHECK-FIXES: ArrayValueInit() {} + // CHECK-FIXES-NEXT: double m_array[1] = {}; }; class ArrayBraceInit { ArrayBraceInit() : m_array{} {} double m_array[1]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayBraceInit() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[1] = {}; + // CHECK-FIXES: ArrayBraceInit() {} + // CHECK-FIXES-NEXT: double m_array[1] = {}; }; class ArrayBraceInitWithValue { ArrayBraceInitWithValue() : m_array{3.14} {} double m_array[1]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayBraceInitWithValue() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[1] = {3.14}; + // CHECK-FIXES: ArrayBraceInitWithValue() {} + // CHECK-FIXES-NEXT: double m_array[1] = {3.14}; }; class ArrayBraceInitMultipleValues { ArrayBraceInitMultipleValues() : m_array{1.0, 2.0, 3.0} {} double m_array[3]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayBraceInitMultipleValues() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[3] = {1.0, 2.0, 3.0}; + // CHECK-FIXES: ArrayBraceInitMultipleValues() {} + // CHECK-FIXES-NEXT: double m_array[3] = {1.0, 2.0, 3.0}; }; } // namespace PR63285 diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp index 52b15dec37cd5..32735014ac119 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp @@ -479,8 +479,8 @@ struct EmptyBracedIntDefault { EmptyBracedIntDefault() : m_i{} {} int m_i; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use default member initializer for 'm_i' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}EmptyBracedIntDefault() {} - // CHECK-FIXES-NEXT: {{^ }}int m_i{}; + // CHECK-FIXES: EmptyBracedIntDefault() {} + // CHECK-FIXES-NEXT: int m_i{}; }; namespace PR63285 { @@ -489,32 +489,32 @@ class ArrayValueInit { ArrayValueInit() : m_array() {} double m_array[1]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayValueInit() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[1]{}; + // CHECK-FIXES: ArrayValueInit() {} + // CHECK-FIXES-NEXT: double m_array[1]{}; }; class ArrayBraceInit { ArrayBraceInit() : m_array{} {} double m_array[1]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayBraceInit() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[1]{}; + // CHECK-FIXES: ArrayBraceInit() {} + // CHECK-FIXES-NEXT: double m_array[1]{}; }; class ArrayBraceInitWithValue { ArrayBraceInitWithValue() : m_array{3.14} {} double m_array[1]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayBraceInitWithValue() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[1]{3.14}; + // CHECK-FIXES: ArrayBraceInitWithValue() {} + // CHECK-FIXES-NEXT: double m_array[1]{3.14}; }; class ArrayBraceInitMultipleValues { ArrayBraceInitMultipleValues() : m_array{1.0, 2.0, 3.0} {} double m_array[3]; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use default member initializer for 'm_array' [modernize-use-default-member-init] - // CHECK-FIXES: {{^ }}ArrayBraceInitMultipleValues() {} - // CHECK-FIXES-NEXT: {{^ }}double m_array[3]{1.0, 2.0, 3.0}; + // CHECK-FIXES: ArrayBraceInitMultipleValues() {} + // CHECK-FIXES-NEXT: double m_array[3]{1.0, 2.0, 3.0}; }; } // namespace PR63285 diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp index 6520620486942..9639e0ea1de63 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp @@ -147,7 +147,7 @@ struct BF { BF(const BF &Other) : Field1(Other.Field1), Field2(Other.Field2), Field3(Other.Field3), Field4(Other.Field4) {}; // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default' - // CHECK-FIXES: BF(const BF &Other) {{$}} + // CHECK-FIXES: BF(const BF &Other) // CHECK-FIXES: = default; BF &operator=(const BF &); diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp index 209ca7d43664e..a606b8491a4ba 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp @@ -127,7 +127,7 @@ Priv::Priv() {} struct SemiColon { SemiColon() {}; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default' - // CHECK-FIXES: SemiColon() = default;{{$}} + // CHECK-FIXES: SemiColon() = default; }; struct SemiColonOutOfLine { @@ -136,16 +136,16 @@ struct SemiColonOutOfLine { SemiColonOutOfLine::SemiColonOutOfLine() {}; // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: use '= default' -// CHECK-FIXES: SemiColonOutOfLine::SemiColonOutOfLine() = default;{{$}} +// CHECK-FIXES: SemiColonOutOfLine::SemiColonOutOfLine() = default; // struct. struct ST { ST() {} // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default' - // CHECK-FIXES: ST() = default;{{$}} + // CHECK-FIXES: ST() = default; ~ST() {} // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default' - // CHECK-FIXES: ST() = default;{{$}} + // CHECK-FIXES: ST() = default; }; // Deleted constructor/destructor. @@ -238,13 +238,13 @@ struct DC : KW { DC() : KW() {} ~DC() override {} // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default' - // CHECK-FIXES: ~DC() override = default;{{$}} + // CHECK-FIXES: ~DC() override = default; }; struct OverrideWithSemiColon : KW { ~OverrideWithSemiColon() override {}; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default' - // CHECK-FIXES: ~OverrideWithSemiColon() override = default;{{$}} + // CHECK-FIXES: ~OverrideWithSemiColon() override = default; }; struct Comments { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-allow-override-and-final.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-allow-override-and-final.cpp index b6c3e0a70999a..8a6024c19abe9 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-allow-override-and-final.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-allow-override-and-final.cpp @@ -17,24 +17,24 @@ struct Base { struct Simple : public Base { virtual ~Simple(); // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^}} ~Simple() override; + // CHECK-FIXES: ~Simple() override; virtual void a() override; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override] - // CHECK-FIXES: {{^}} void a() override; + // CHECK-FIXES: void a() override; virtual void b() final; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'final' [modernize-use-override] - // CHECK-FIXES: {{^}} void b() final; + // CHECK-FIXES: void b() final; virtual void c() final override; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'final' [modernize-use-override] - // CHECK-FIXES: {{^}} void c() final override; + // CHECK-FIXES: void c() final override; virtual void d() override final; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'final' [modernize-use-override] - // CHECK-FIXES: {{^}} void d() override final; + // CHECK-FIXES: void d() override final; void e() final override; void f() override final; void g() final; void h() override; void i(); // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override] - // CHECK-FIXES: {{^}} void i() override; + // CHECK-FIXES: void i() override; }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-ms.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-ms.cpp index e7c00895860c2..a2720430b3935 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-ms.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-ms.cpp @@ -14,12 +14,12 @@ class EXPORT InheritedBase { class Derived : public Base { virtual EXPORT void a(); // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^}} EXPORT void a() override; + // CHECK-FIXES: EXPORT void a() override; }; class EXPORT InheritedDerived : public InheritedBase { virtual void a(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^}} void a() override; + // CHECK-FIXES: void a() override; }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-no-destructors.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-no-destructors.cpp index 2012d71c269a6..97e2220fe39e8 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-no-destructors.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-no-destructors.cpp @@ -11,5 +11,5 @@ struct Simple : public Base { // CHECK-MESSAGES-NOT: warning: virtual void f(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void f() override; + // CHECK-FIXES: void f() override; }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-templates.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-templates.cpp index a06ada8964171..631f0d7cef45a 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-templates.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-templates.cpp @@ -43,5 +43,5 @@ struct Derived2 : BaseS, BaseU { // should warn, comes from non-template BaseU virtual void boo3(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^ }}void boo3() override; + // CHECK-FIXES: void boo3() override; }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-macro.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-macro.cpp index f9ac6d462fa39..0e9a186aab900 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-macro.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-macro.cpp @@ -29,41 +29,41 @@ struct SimpleCases : public Base { public: virtual ~SimpleCases(); // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'OVERRIDE' or (rarely) 'FINAL' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^}} ~SimpleCases() OVERRIDE; + // CHECK-FIXES: ~SimpleCases() OVERRIDE; void a(); // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this function with 'OVERRIDE' or (rarely) 'FINAL' [modernize-use-override] - // CHECK-FIXES: {{^}} void a() OVERRIDE; + // CHECK-FIXES: void a() OVERRIDE; virtual void b(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using 'OVERRIDE' or (rarely) 'FINAL' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^}} void b() OVERRIDE; + // CHECK-FIXES: void b() OVERRIDE; virtual void c(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void c() OVERRIDE; + // CHECK-FIXES: void c() OVERRIDE; virtual void e() = 0; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void e() OVERRIDE = 0; + // CHECK-FIXES: void e() OVERRIDE = 0; virtual void f2() const = 0; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void f2() const OVERRIDE = 0; + // CHECK-FIXES: void f2() const OVERRIDE = 0; virtual void g() ABSTRACT; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void g() OVERRIDE ABSTRACT; + // CHECK-FIXES: void g() OVERRIDE ABSTRACT; virtual void j() const; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void j() const OVERRIDE; + // CHECK-FIXES: void j() const OVERRIDE; virtual void k() OVERRIDE; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'OVERRIDE' [modernize-use-override] - // CHECK-FIXES: {{^}} void k() OVERRIDE; + // CHECK-FIXES: void k() OVERRIDE; virtual void l() const OVERRIDE; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'OVERRIDE' [modernize-use-override] - // CHECK-FIXES: {{^}} void l() const OVERRIDE; + // CHECK-FIXES: void l() const OVERRIDE; }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-no-macro-inscope.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-no-macro-inscope.cpp index 924dd536e6233..f348147e2cf04 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-no-macro-inscope.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-no-macro-inscope.cpp @@ -15,13 +15,13 @@ struct SimpleCases : public Base { public: virtual ~SimpleCases(); // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^}} virtual ~SimpleCases(); + // CHECK-FIXES: virtual ~SimpleCases(); void a(); // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this function with 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' [modernize-use-override] - // CHECK-FIXES: {{^}} void a(); + // CHECK-FIXES: void a(); virtual void b(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' instead of 'virtual' [modernize-use-override] - // CHECK-FIXES: {{^}} virtual void b(); + // CHECK-FIXES: virtual void b(); }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp index c5745e39a324d..809e43518cb0f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp @@ -54,182 +54,182 @@ struct SimpleCases : public Base { public: virtual ~SimpleCases(); // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' - // CHECK-FIXES: {{^}} ~SimpleCases() override; + // CHECK-FIXES: ~SimpleCases() override; void a(); // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this - // CHECK-FIXES: {{^}} void a() override; + // CHECK-FIXES: void a() override; void b() override; // CHECK-MESSAGES-NOT: warning: - // CHECK-FIXES: {{^}} void b() override; + // CHECK-FIXES: void b() override; virtual void c(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void c() override; + // CHECK-FIXES: void c() override; virtual void d() override; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'override' - // CHECK-FIXES: {{^}} void d() override; + // CHECK-FIXES: void d() override; virtual void d2() final; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'final' - // CHECK-FIXES: {{^}} void d2() final; + // CHECK-FIXES: void d2() final; virtual void e() = 0; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void e() override = 0; + // CHECK-FIXES: void e() override = 0; virtual void f()=0; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void f() override =0; + // CHECK-FIXES: void f() override =0; virtual void f2() const=0; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void f2() const override =0; + // CHECK-FIXES: void f2() const override =0; virtual void g() ABSTRACT; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void g() override ABSTRACT; + // CHECK-FIXES: void g() override ABSTRACT; virtual void j() const; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void j() const override; + // CHECK-FIXES: void j() const override; virtual MustUseResultObject k(); // Has an implicit attribute. // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: prefer using - // CHECK-FIXES: {{^}} MustUseResultObject k() override; + // CHECK-FIXES: MustUseResultObject k() override; virtual bool l() MUST_USE_RESULT UNUSED; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} bool l() override MUST_USE_RESULT UNUSED; + // CHECK-FIXES: bool l() override MUST_USE_RESULT UNUSED; virtual bool n() UNUSED MUST_USE_RESULT; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} bool n() override UNUSED MUST_USE_RESULT; + // CHECK-FIXES: bool n() override UNUSED MUST_USE_RESULT; void m() override final; // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: 'override' is redundant since the function is already declared 'final' - // CHECK-FIXES: {{^}} void m() final; + // CHECK-FIXES: void m() final; virtual void m2() override final; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' and 'override' are redundant since the function is already declared 'final' - // CHECK-FIXES: {{^}} void m2() final; + // CHECK-FIXES: void m2() final; virtual void o() __attribute__((unused)); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void o() override __attribute__((unused)); + // CHECK-FIXES: void o() override __attribute__((unused)); virtual void ne() noexcept(false); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void ne() noexcept(false) override; + // CHECK-FIXES: void ne() noexcept(false) override; virtual void t() throw(); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void t() throw() override; + // CHECK-FIXES: void t() throw() override; virtual /* */ void g2(); // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' - // CHECK-FIXES: {{^}} /* */ void g2() override; + // CHECK-FIXES: /* */ void g2() override; }; // CHECK-MESSAGES-NOT: warning: void SimpleCases::c() {} -// CHECK-FIXES: {{^}}void SimpleCases::c() {} +// CHECK-FIXES: void SimpleCases::c() {} SimpleCases::~SimpleCases() {} -// CHECK-FIXES: {{^}}SimpleCases::~SimpleCases() {} +// CHECK-FIXES: SimpleCases::~SimpleCases() {} struct DefaultedDestructor : public Base { DefaultedDestructor() {} virtual ~DefaultedDestructor() = default; // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using - // CHECK-FIXES: {{^}} ~DefaultedDestructor() override = default; + // CHECK-FIXES: ~DefaultedDestructor() override = default; }; struct FinalSpecified : public Base { public: virtual ~FinalSpecified() final; // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 'virtual' is redundant since the function is already declared 'final' - // CHECK-FIXES: {{^}} ~FinalSpecified() final; + // CHECK-FIXES: ~FinalSpecified() final; void b() final; // CHECK-MESSAGES-NOT: warning: - // CHECK-FIXES: {{^}} void b() final; + // CHECK-FIXES: void b() final; virtual void d() final; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant - // CHECK-FIXES: {{^}} void d() final; + // CHECK-FIXES: void d() final; virtual void e() final = 0; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant - // CHECK-FIXES: {{^}} void e() final = 0; + // CHECK-FIXES: void e() final = 0; virtual void j() const final; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant - // CHECK-FIXES: {{^}} void j() const final; + // CHECK-FIXES: void j() const final; virtual bool l() final MUST_USE_RESULT UNUSED; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant - // CHECK-FIXES: {{^}} bool l() final MUST_USE_RESULT UNUSED; + // CHECK-FIXES: bool l() final MUST_USE_RESULT UNUSED; }; struct InlineDefinitions : public Base { public: virtual ~InlineDefinitions() {} // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using - // CHECK-FIXES: {{^}} ~InlineDefinitions() override {} + // CHECK-FIXES: ~InlineDefinitions() override {} void a() {} // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this - // CHECK-FIXES: {{^}} void a() override {} + // CHECK-FIXES: void a() override {} void b() override {} // CHECK-MESSAGES-NOT: warning: - // CHECK-FIXES: {{^}} void b() override {} + // CHECK-FIXES: void b() override {} virtual void c() {} // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void c() override + // CHECK-FIXES: void c() override virtual void d() override {} // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant - // CHECK-FIXES: {{^}} void d() override {} + // CHECK-FIXES: void d() override {} virtual void j() const {} // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void j() const override + // CHECK-FIXES: void j() const override virtual MustUseResultObject k(); // Has an implicit attribute. // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: prefer using - // CHECK-FIXES: {{^}} MustUseResultObject k() override; + // CHECK-FIXES: MustUseResultObject k() override; virtual bool l() MUST_USE_RESULT UNUSED; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} bool l() override MUST_USE_RESULT UNUSED; + // CHECK-FIXES: bool l() override MUST_USE_RESULT UNUSED; virtual void r() & {} // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void r() & override + // CHECK-FIXES: void r() & override virtual void rr() && {} // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void rr() && override + // CHECK-FIXES: void rr() && override virtual void cv() const volatile {} // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void cv() const volatile override + // CHECK-FIXES: void cv() const volatile override virtual void cv2() const volatile // some comment {} // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void cv2() const volatile override // some comment + // CHECK-FIXES: void cv2() const volatile override // some comment }; struct DefaultArguments : public Base { @@ -237,7 +237,7 @@ struct DefaultArguments : public Base { // Make sure the override fix is placed after the argument list. void il(IntPair p = {1, (2 + (3))}) {} // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this - // CHECK-FIXES: {{^}} void il(IntPair p = {1, (2 + (3))}) override {} + // CHECK-FIXES: void il(IntPair p = {1, (2 + (3))}) override {} }; struct Macros : public Base { @@ -245,31 +245,31 @@ struct Macros : public Base { // give up for now. NOT_VIRTUAL void a() NOT_OVERRIDE; // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: annotate this - // CHECK-FIXES: {{^}} NOT_VIRTUAL void a() override NOT_OVERRIDE; + // CHECK-FIXES: NOT_VIRTUAL void a() override NOT_OVERRIDE; VIRTUAL void b() NOT_OVERRIDE; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} VIRTUAL void b() override NOT_OVERRIDE; + // CHECK-FIXES: VIRTUAL void b() override NOT_OVERRIDE; NOT_VIRTUAL void c() OVERRIDE; // CHECK-MESSAGES-NOT: warning: - // CHECK-FIXES: {{^}} NOT_VIRTUAL void c() OVERRIDE; + // CHECK-FIXES: NOT_VIRTUAL void c() OVERRIDE; VIRTUAL void d() OVERRIDE; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant - // CHECK-FIXES: {{^}} VIRTUAL void d() OVERRIDE; + // CHECK-FIXES: VIRTUAL void d() OVERRIDE; #define FUNC(return_type, name) return_type name() FUNC(void, e); - // CHECK-FIXES: {{^}} FUNC(void, e); + // CHECK-FIXES: FUNC(void, e); #define F virtual void f(); F - // CHECK-FIXES: {{^}} F + // CHECK-FIXES: F VIRTUAL void g() OVERRIDE final; // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' and 'override' are redundant - // CHECK-FIXES: {{^}} VIRTUAL void g() final; + // CHECK-FIXES: VIRTUAL void g() final; }; // Tests for templates. @@ -280,7 +280,7 @@ template struct TemplateBase { template struct DerivedFromTemplate : public TemplateBase { virtual void f(T t); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void f(T t) override; + // CHECK-FIXES: void f(T t) override; }; void f() { DerivedFromTemplate().f(2); } @@ -288,7 +288,7 @@ template struct UnusedMemberInstantiation : public C { virtual ~UnusedMemberInstantiation() {} // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using - // CHECK-FIXES: {{^}} ~UnusedMemberInstantiation() override {} + // CHECK-FIXES: ~UnusedMemberInstantiation() override {} }; struct IntantiateWithoutUse : public UnusedMemberInstantiation {}; @@ -303,7 +303,7 @@ template struct MembersOfSpecializations : public Base2 { void a() override; // CHECK-MESSAGES-NOT: warning: - // CHECK-FIXES: {{^}} void a() override; + // CHECK-FIXES: void a() override; }; template <> void MembersOfSpecializations<3>::a() {} void ff() { MembersOfSpecializations<3>().a(); }; @@ -313,11 +313,11 @@ void ff() { MembersOfSpecializations<3>().a(); }; struct TryStmtAsBody : public Base { void a() try // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this - // CHECK-FIXES: {{^}} void a() override try + // CHECK-FIXES: void a() override try { b(); } catch(...) { c(); } virtual void d() try // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} void d() override try + // CHECK-FIXES: void d() override try { e(); } catch(...) { f(); } }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-cxx20.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-cxx20.cpp index 8a0618d154fd4..dd45094464d42 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-cxx20.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-cxx20.cpp @@ -17,11 +17,11 @@ concept floating_point = std::is_same::value || std::is_same std::floating_point auto;{{$}} +// CHECK-FIXES: auto con1() -> std::floating_point auto; std::floating_point auto con1() { return 3.14f; } // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}auto con1() -> std::floating_point auto { return 3.14f; }{{$}} +// CHECK-FIXES: auto con1() -> std::floating_point auto { return 3.14f; } namespace a { template @@ -33,25 +33,25 @@ concept BinaryConcept = true; a::Concept decltype(auto) con2(); // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}auto con2() -> a::Concept decltype(auto);{{$}} +// CHECK-FIXES: auto con2() -> a::Concept decltype(auto); a::BinaryConcept decltype(auto) con3(); // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}auto con3() -> a::BinaryConcept decltype(auto);{{$}} +// CHECK-FIXES: auto con3() -> a::BinaryConcept decltype(auto); const std::floating_point auto* volatile con4(); // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}auto con4() -> const std::floating_point auto* volatile;{{$}} +// CHECK-FIXES: auto con4() -> const std::floating_point auto* volatile; template int req1(T t) requires std::floating_point; // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}auto req1(T t) -> int requires std::floating_point;{{$}} +// CHECK-FIXES: auto req1(T t) -> int requires std::floating_point; template T req2(T t) requires requires { t + t; }; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a trailing return type for this function [modernize-use-trailing-return-type] - // CHECK-FIXES: {{^}}auto req2(T t) -> T requires requires { t + t; };{{$}} + // CHECK-FIXES: auto req2(T t) -> T requires requires { t + t; }; // // Operator c++20 defaulted comparison operators @@ -96,7 +96,7 @@ struct TestDefaultOperatorB { friend auto operator==(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default; friend bool operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept = default; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use a trailing return type for this function [modernize-use-trailing-return-type] - // CHECK-FIXES: {{^}} friend auto operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default;{{$}} + // CHECK-FIXES: friend auto operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default; }; namespace PR69863 { @@ -109,7 +109,7 @@ struct CustomCompileTimeString { template constexpr decltype(Str) operator""__csz() noexcept { // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}constexpr auto operator""__csz() noexcept -> decltype(Str) { +// CHECK-FIXES: constexpr auto operator""__csz() noexcept -> decltype(Str) { return Str; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-transform-lambdas-cxx14.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-transform-lambdas-cxx14.cpp index 33051c63e4f17..cd88c84629ce4 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-transform-lambdas-cxx14.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-transform-lambdas-cxx14.cpp @@ -10,15 +10,15 @@ namespace std { void test_lambda_positive() { auto l1 = [](auto x) { return x; }; // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use a trailing return type for this lambda [modernize-use-trailing-return-type] - // CHECK-FIXES: {{^}} auto l1 = [](auto x) -> auto { return x; };{{$}} + // CHECK-FIXES: auto l1 = [](auto x) -> auto { return x; }; } template