Skip to content

Conversation

@nicovank
Copy link
Contributor

check_clang_tidy now matches full lines only, so {{^}} clauses are no longer necessary.

I am splitting those changes over multiple PRs to make review easier. Numbering them but the actual order doesn't matter.

`check_clang_tidy` now matches full lines only, so `{{^}}` clauses are no longer necessary.

I am splitting those changes over multiple PRs to make review easier. Numbering them but the actual order doesn't matter.
@llvmbot
Copy link
Member

llvmbot commented Apr 15, 2025

@llvm/pr-subscribers-clang-tidy

@llvm/pr-subscribers-clang-tools-extra

Author: Nicolas van Kempen (nicovank)

Changes

check_clang_tidy now matches full lines only, so {{^}} clauses are no longer necessary.

I am splitting those changes over multiple PRs to make review easier. Numbering them but the actual order doesn't matter.


Patch is 35.30 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/135826.diff

10 Files Affected:

  • (modified) clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-startswith.cpp (+16-16)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-c.c (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier.cpp (+36-36)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp (+12-12)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/llvm/qualified-auto.cpp (+2-2)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/misc/static-assert.cpp (+34-34)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique-macros.cpp (+5-5)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp (+3-3)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-bool-literals-ignore-macros.cpp (+27-27)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-cxx98.cpp (+3-3)
diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-startswith.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-startswith.cpp
index aabb30fe34f78..c2ce0e347e074 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-startswith.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-startswith.cpp
@@ -29,67 +29,67 @@ std::string bar();
 void tests(std::string s, global_string s2, std::string_view sv) {
   s.find("a") == 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith instead of find() == 0 [abseil-string-find-startswith]
-  // CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, "a");{{$}}
+  // CHECK-FIXES: absl::StartsWith(s, "a");
 
   s.find(s) == 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, s);{{$}}
+  // CHECK-FIXES: absl::StartsWith(s, s);
 
   s.find("aaa") != 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "aaa");{{$}}
+  // CHECK-FIXES: !absl::StartsWith(s, "aaa");
 
   s.find(foo(foo(bar()))) != 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, foo(foo(bar())));{{$}}
+  // CHECK-FIXES: !absl::StartsWith(s, foo(foo(bar())));
 
   if (s.find("....") == 0) { /* do something */ }
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}if (absl::StartsWith(s, "....")) { /* do something */ }{{$}}
+  // CHECK-FIXES: if (absl::StartsWith(s, "....")) { /* do something */ }
 
   0 != s.find("a");
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "a");{{$}}
+  // CHECK-FIXES: !absl::StartsWith(s, "a");
 
   s2.find("a") == 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s2, "a");{{$}}
+  // CHECK-FIXES: absl::StartsWith(s2, "a");
 
   s.rfind("a", 0) == 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith instead of rfind() == 0 [abseil-string-find-startswith]
-  // CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, "a");{{$}}
+  // CHECK-FIXES: absl::StartsWith(s, "a");
 
   s.rfind(s, 0) == 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, s);{{$}}
+  // CHECK-FIXES: absl::StartsWith(s, s);
 
   s.rfind("aaa", 0) != 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "aaa");{{$}}
+  // CHECK-FIXES: !absl::StartsWith(s, "aaa");
 
   s.rfind(foo(foo(bar())), 0) != 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, foo(foo(bar())));{{$}}
+  // CHECK-FIXES: !absl::StartsWith(s, foo(foo(bar())));
 
   if (s.rfind("....", 0) == 0) { /* do something */ }
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}if (absl::StartsWith(s, "....")) { /* do something */ }{{$}}
+  // CHECK-FIXES: if (absl::StartsWith(s, "....")) { /* do something */ }
 
   0 != s.rfind("a", 0);
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "a");{{$}}
+  // CHECK-FIXES: !absl::StartsWith(s, "a");
 
   s2.rfind("a", 0) == 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s2, "a");{{$}}
+  // CHECK-FIXES: absl::StartsWith(s2, "a");
 
   sv.find("a") == 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(sv, "a");{{$}}
+  // CHECK-FIXES: absl::StartsWith(sv, "a");
 
   sv.rfind("a", 0) != 0;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
-  // CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(sv, "a");{{$}}
+  // CHECK-FIXES: !absl::StartsWith(sv, "a");
 
   // expressions that don't trigger the check are here.
   A_MACRO(s.find("a"), 0);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-c.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-c.c
index 9d075433ab9eb..30a4423f3d14d 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-c.c
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier-c.c
@@ -7,4 +7,4 @@ void f__o__o(void);
 void f_________oo(void);
 void __foo(void);
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '__foo', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void foo(void);{{$}}
+// CHECK-FIXES: void foo(void);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier.cpp
index 1951167b41093..0f36efe656bf9 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/reserved-identifier.cpp
@@ -8,35 +8,35 @@
 
 #define _MACRO(m) int m = 0
 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration uses identifier '_MACRO', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}#define MACRO(m) int m = 0{{$}}
+// CHECK-FIXES: #define MACRO(m) int m = 0
 
 namespace _Ns {
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration uses identifier '_Ns', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}namespace Ns {{{$}}
+// CHECK-FIXES: namespace Ns {
 
 class _Object {
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Object', which is a reserved identifier [bugprone-reserved-identifier]
-  // CHECK-FIXES: {{^}}class Object {{{$}}
+  // CHECK-FIXES: class Object {
   int _Member;
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Member', which is a reserved identifier [bugprone-reserved-identifier]
-  // CHECK-FIXES: {{^}}  int Member;{{$}}
+  // CHECK-FIXES: int Member;
 };
 
 float _Global;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Global', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}float Global;{{$}}
+// CHECK-FIXES: float Global;
 
 void _Function() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '_Function', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void Function() {}{{$}}
+// CHECK-FIXES: void Function() {}
 
 using _Alias = int;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Alias', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}using Alias = int;{{$}}
+// CHECK-FIXES: using Alias = int;
 
 template <typename _TemplateParam>
 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: declaration uses identifier '_TemplateParam', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}template <typename TemplateParam>{{$}}
+// CHECK-FIXES: template <typename TemplateParam>
 struct S {};
 
 } // namespace _Ns
@@ -45,34 +45,34 @@ struct S {};
 
 #define __macro(m) int m = 0
 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration uses identifier '__macro', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}#define _macro(m) int m = 0{{$}}
+// CHECK-FIXES: #define _macro(m) int m = 0
 
 namespace __ns {
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration uses identifier '__ns', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}namespace ns {{{$}}
+// CHECK-FIXES: namespace ns {
 class __object {
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__object', which is a reserved identifier [bugprone-reserved-identifier]
-  // CHECK-FIXES: {{^}}class _object {{{$}}
+  // CHECK-FIXES: class _object {
   int __member;
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__member', which is a reserved identifier [bugprone-reserved-identifier]
-  // CHECK-FIXES: {{^}}  int _member;{{$}}
+  // CHECK-FIXES: int _member;
 };
 
 float __global;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__global', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}float _global;{{$}}
+// CHECK-FIXES: float _global;
 
 void __function() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '__function', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void _function() {}{{$}}
+// CHECK-FIXES: void _function() {}
 
 using __alias = int;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__alias', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}using _alias = int;{{$}}
+// CHECK-FIXES: using _alias = int;
 
 template <typename __templateParam>
 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: declaration uses identifier '__templateParam', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}template <typename _templateParam>{{$}}
+// CHECK-FIXES: template <typename _templateParam>
 struct S {};
 
 } // namespace __ns
@@ -81,34 +81,34 @@ struct S {};
 
 #define macro___m(m) int m = 0
 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration uses identifier 'macro___m', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}#define macro_m(m) int m = 0{{$}}
+// CHECK-FIXES: #define macro_m(m) int m = 0
 
 namespace ns___n {
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration uses identifier 'ns___n', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}namespace ns_n {{{$}}
+// CHECK-FIXES: namespace ns_n {
 class object___o {
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier 'object___o', which is a reserved identifier [bugprone-reserved-identifier]
-  // CHECK-FIXES: {{^}}class object_o {{{$}}
+  // CHECK-FIXES: class object_o {
   int member___m;
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier 'member___m', which is a reserved identifier [bugprone-reserved-identifier]
-  // CHECK-FIXES: {{^}}  int member_m;{{$}}
+  // CHECK-FIXES: int member_m;
 };
 
 float global___g;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier 'global___g', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}float global_g;{{$}}
+// CHECK-FIXES: float global_g;
 
 void function___f() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier 'function___f', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void function_f() {}{{$}}
+// CHECK-FIXES: void function_f() {}
 
 using alias___a = int;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier 'alias___a', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}using alias_a = int;{{$}}
+// CHECK-FIXES: using alias_a = int;
 
 template <typename templateParam___t>
 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: declaration uses identifier 'templateParam___t', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}template <typename templateParam_t>{{$}}
+// CHECK-FIXES: template <typename templateParam_t>
 struct S {};
 
 } // namespace ns___n
@@ -121,55 +121,55 @@ struct S {};
 
 namespace _ns {
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration uses identifier '_ns', which is reserved in the global namespace [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}namespace ns {{{$}}
+// CHECK-FIXES: namespace ns {
 int _i;
 // no warning
 } // namespace _ns
 class _object {
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_object', which is reserved in the global namespace [bugprone-reserved-identifier]
-  // CHECK-FIXES: {{^}}class object {{{$}}
+  // CHECK-FIXES: class object {
   int _member;
   // no warning
 };
 float _global;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_global', which is reserved in the global namespace [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}float global;{{$}}
+// CHECK-FIXES: float global;
 void _function() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '_function', which is reserved in the global namespace [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void function() {}{{$}}
+// CHECK-FIXES: void function() {}
 using _alias = int;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_alias', which is reserved in the global namespace [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}using alias = int;{{$}}
+// CHECK-FIXES: using alias = int;
 template <typename _templateParam> // no warning, template params are not in the global namespace
 struct S {};
 
 void _float() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '_float', which is reserved in the global namespace; cannot be fixed because 'float' would conflict with a keyword [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void _float() {}{{$}}
+// CHECK-FIXES: void _float() {}
 
 #define SOME_MACRO
 int SOME__MACRO;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration uses identifier 'SOME__MACRO', which is a reserved identifier; cannot be fixed because 'SOME_MACRO' would conflict with a macro definition [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}int SOME__MACRO;{{$}}
+// CHECK-FIXES: int SOME__MACRO;
 
 void _TWO__PROBLEMS() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '_TWO__PROBLEMS', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void TWO_PROBLEMS() {}{{$}}
+// CHECK-FIXES: void TWO_PROBLEMS() {}
 void _two__problems() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '_two__problems', which is a reserved identifier [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}void two_problems() {}{{$}}
+// CHECK-FIXES: void two_problems() {}
 
 int __;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration uses identifier '__', which is a reserved identifier; cannot be fixed automatically [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}int __;{{$}}
+// CHECK-FIXES: int __;
 
 int _________;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration uses identifier '_________', which is a reserved identifier; cannot be fixed automatically [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}int _________;{{$}}
+// CHECK-FIXES: int _________;
 
 int _;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration uses identifier '_', which is reserved in the global namespace; cannot be fixed automatically [bugprone-reserved-identifier]
-// CHECK-FIXES: {{^}}int _;{{$}}
+// CHECK-FIXES: int _;
 
 // This should not trigger a warning
 // https://github.com/llvm/llvm-project/issues/52895
diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp b/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
index bc53b54264af8..7ccdf705e8399 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
@@ -16,16 +16,16 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
   Typedef1 t1;
   (Typedef2)t1;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: C-style casts are discouraged; use static_cast (if needed, the cast may be redundant) [google-readability-casting]
-  // CHECK-FIXES: {{^}}  static_cast<Typedef2>(t1);
+  // CHECK-FIXES: static_cast<Typedef2>(t1);
   (const char*)t1;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: {{.*}}; use static_cast (if needed
-  // CHECK-FIXES: {{^}}  static_cast<const char*>(t1);
+  // CHECK-FIXES: static_cast<const char*>(t1);
   (Typedef1)cpc;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: {{.*}}; use static_cast (if needed
-  // CHECK-FIXES: {{^}}  static_cast<Typedef1>(cpc);
+  // CHECK-FIXES: static_cast<Typedef1>(cpc);
   (Typedef1)t1;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: redundant cast to the same type
-  // CHECK-FIXES: {{^}}  t1;
+  // CHECK-FIXES: t1;
 
   char *pc = (char*)cpc;
   // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: C-style casts are discouraged; use const_cast [google-readability-casting]
@@ -33,15 +33,15 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
   typedef char Char;
   Char *pChar = (Char*)pc;
   // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}}; use static_cast (if needed
-  // CHECK-FIXES: {{^}}  Char *pChar = static_cast<Char*>(pc);
+  // CHECK-FIXES: Char *pChar = static_cast<Char*>(pc);
 
   (Char)*cpc;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: {{.*}}; use static_cast (if needed
-  // CHECK-FIXES: {{^}}  static_cast<Char>(*cpc);
+  // CHECK-FIXES: static_cast<Char>(*cpc);
 
   (char)*pChar;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: {{.*}}; use static_cast (if needed
-  // CHECK-FIXES: {{^}}  static_cast<char>(*pChar);
+  // CHECK-FIXES: static_cast<char>(*pChar);
 
   (const char*)cpv;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: {{.*}}; use static_cast [
@@ -124,24 +124,24 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
 
   e = (Enum)Enum1;
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant cast to the same type
-  // CHECK-FIXES: {{^}}  e = Enum1;
+  // CHECK-FIXES: e = Enum1;
 
   e = (Enum)e;
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant cast to the same type
-  // CHECK-FIXES: {{^}}  e = e;
+  // CHECK-FIXES: e = e;
 
   e = (Enum)           e;
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant cast to the same type
-  // CHECK-FIXES: {{^}}  e = e;
+  // CHECK-FIXES: e = e;
 
   e = (Enum)           (e);
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant cast to the same type
-  // CHECK-FIXES: {{^}}  e = (e);
+  // CHECK-FIXES: e = (e);
 
   static const int kZero = 0;
   (int)kZero;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: redundant cast to the same type
-  // CHECK-FIXES: {{^}}  kZero;
+  // CHECK-FIXES: kZero;
 
   int b2 = static_cast<double>(b);
   int b3 = b;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/llvm/qualified-auto.cpp b/clang-tools-extra/test/clang-tidy/checkers/llvm/qualified-auto.cpp
index 97473ae41ec64..c39f7184f2794 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/llvm/qualified-auto.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/llvm/qualified-auto.cpp
@@ -10,10 +10,10 @@ const int *getCIntPtr();
 void foo() {
   auto NakedPtr = getIntPtr();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'auto NakedPtr' can be declared as 'auto *NakedPtr'
-  // CHECK-FIXES: {{^}}  auto *NakedPtr = getIntPtr();
+  // CHECK-FIXES: auto *NakedPtr = getIntPtr();
   auto NakedConstPtr = getCIntPtr();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'auto NakedConstPtr' can be declared as 'const auto *NakedConstPtr'
-  // CHECK-FIXES: {{^}}  const auto *NakedConstPtr = getCIntPtr();
+  // CHECK-FIXES: const auto *NakedConstPtr = getCIntPtr();
   auto *Ptr = getIntPtr();
   auto *ConstPtr = getCIntPtr();
   auto &NakedRef = *getIntPtr();
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/static-assert.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/static-assert.cpp
index 16c6ba60c1925..897049cbc5388 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/static-assert.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/static-assert.cpp
@@ -40,24 +40,24 @@ constexpr int Y = 1;
 void referenceConstexprVariable() {
   assert(Y > 0);
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be replaced by static_assert() [misc-static-assert]
-  // CHECK-FIXES-CXX11: {{^  }}static_assert(Y > 0, "");
-  // CHECK-FIXES-CXX17: {{^  }}static_assert(Y > 0);
+  // CHECK-FIXES-CXX11: static_assert(Y > 0, "");
+  // CHECK-FIXES-CXX17: static_assert(Y > 0);
 }
 
 void useInSizeOf() {
   char a = 0;
   assert(sizeof(a) == 1U);
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be replaced by s...
[truncated]

Copy link
Contributor

@carlosgalvezp carlosgalvezp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nicovank nicovank merged commit 09680dc into llvm:main Apr 17, 2025
14 checks passed
@nicovank nicovank deleted the pr135826 branch April 17, 2025 17:55
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
`check_clang_tidy` now matches full lines only, so `{{^}}` clauses are
no longer necessary.

I am splitting those changes over multiple PRs to make review easier.
Numbering them but the actual order doesn't matter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants