Skip to content

Commit d56afce

Browse files
authored
[NFC][clang-tidy] Remove {{^}} clauses in some tests (2/N) (#135824)
`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.
1 parent f972985 commit d56afce

11 files changed

+60
-60
lines changed

clang-tools-extra/test/clang-tidy/checkers/bugprone/misplaced-operator-in-strlen-in-alloc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,43 @@ size_t wcsnlen_s(const wchar_t *, size_t);
1919
void bad_malloc(char *name) {
2020
char *new_name = (char *)malloc(strlen(name + 1));
2121
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: addition operator is applied to the argument of strlen
22-
// CHECK-FIXES: {{^ char \*new_name = \(char \*\)malloc\(}}strlen(name) + 1{{\);$}}
22+
// CHECK-FIXES: char *new_name = (char *)malloc(strlen(name) + 1);
2323
new_name = (char *)malloc(strnlen(name + 1, 10));
2424
// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: addition operator is applied to the argument of strnlen
25-
// CHECK-FIXES: {{^ new_name = \(char \*\)malloc\(}}strnlen(name, 10) + 1{{\);$}}
25+
// CHECK-FIXES: new_name = (char *)malloc(strnlen(name, 10) + 1);
2626
new_name = (char *)malloc(strnlen_s(name + 1, 10));
2727
// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: addition operator is applied to the argument of strnlen_s
28-
// CHECK-FIXES: {{^ new_name = \(char \*\)malloc\(}}strnlen_s(name, 10) + 1{{\);$}}
28+
// CHECK-FIXES: new_name = (char *)malloc(strnlen_s(name, 10) + 1);
2929
}
3030

3131
void bad_malloc_wide(wchar_t *name) {
3232
wchar_t *new_name = (wchar_t *)malloc(wcslen(name + 1));
3333
// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: addition operator is applied to the argument of wcslen
34-
// CHECK-FIXES: {{^ wchar_t \*new_name = \(wchar_t \*\)malloc\(}}wcslen(name) + 1{{\);$}}
34+
// CHECK-FIXES: wchar_t *new_name = (wchar_t *)malloc(wcslen(name) + 1);
3535
new_name = (wchar_t *)malloc(wcsnlen(name + 1, 10));
3636
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: addition operator is applied to the argument of wcsnlen
37-
// CHECK-FIXES: {{^ new_name = \(wchar_t \*\)malloc\(}}wcsnlen(name, 10) + 1{{\);$}}
37+
// CHECK-FIXES: new_name = (wchar_t *)malloc(wcsnlen(name, 10) + 1);
3838
new_name = (wchar_t *)malloc(wcsnlen_s(name + 1, 10));
3939
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: addition operator is applied to the argument of wcsnlen_s
40-
// CHECK-FIXES: {{^ new_name = \(wchar_t \*\)malloc\(}}wcsnlen_s(name, 10) + 1{{\);$}}
40+
// CHECK-FIXES: new_name = (wchar_t *)malloc(wcsnlen_s(name, 10) + 1);
4141
}
4242

4343
void bad_alloca(char *name) {
4444
char *new_name = (char *)alloca(strlen(name + 1));
4545
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: addition operator is applied to the argument of strlen
46-
// CHECK-FIXES: {{^ char \*new_name = \(char \*\)alloca\(}}strlen(name) + 1{{\);$}}
46+
// CHECK-FIXES: char *new_name = (char *)alloca(strlen(name) + 1);
4747
}
4848

4949
void bad_calloc(char *name) {
5050
char *new_names = (char *)calloc(2, strlen(name + 1));
5151
// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: addition operator is applied to the argument of strlen
52-
// CHECK-FIXES: {{^ char \*new_names = \(char \*\)calloc\(2, }}strlen(name) + 1{{\);$}}
52+
// CHECK-FIXES: char *new_names = (char *)calloc(2, strlen(name) + 1);
5353
}
5454

5555
void bad_realloc(char *old_name, char *name) {
5656
char *new_name = (char *)realloc(old_name, strlen(name + 1));
5757
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: addition operator is applied to the argument of strlen
58-
// CHECK-FIXES: {{^ char \*new_name = \(char \*\)realloc\(old_name, }}strlen(name) + 1{{\);$}}
58+
// CHECK-FIXES: char *new_name = (char *)realloc(old_name, strlen(name) + 1);
5959
}
6060

6161
void intentional1(char *name) {
@@ -81,5 +81,5 @@ void (*(*const alloc_ptr)(size_t)) = malloc;
8181
void bad_indirect_alloc(char *name) {
8282
char *new_name = (char *)alloc_ptr(strlen(name + 1));
8383
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: addition operator is applied to the argument of strlen
84-
// CHECK-FIXES: {{^ char \*new_name = \(char \*\)alloc_ptr\(}}strlen(name) + 1{{\);$}}
84+
// CHECK-FIXES: char *new_name = (char *)alloc_ptr(strlen(name) + 1);
8585
}

clang-tools-extra/test/clang-tidy/checkers/google/explicit-constructor.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ struct A {
4444

4545
explicit A(const A& a) {}
4646
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: copy constructor should not be declared explicit [google-explicit-constructor]
47-
// CHECK-FIXES: {{^ }}A(const A& a) {}
47+
// CHECK-FIXES: A(const A& a) {}
4848

4949
A(int x1);
5050
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
51-
// CHECK-FIXES: {{^ }}explicit A(int x1);
51+
// CHECK-FIXES: explicit A(int x1);
5252

5353
A(double x2, double y = 3.14) {}
5454
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructors that are callable with a single argument must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
55-
// CHECK-FIXES: {{^ }}explicit A(double x2, double y = 3.14) {}
55+
// CHECK-FIXES: explicit A(double x2, double y = 3.14) {}
5656

5757
template <typename... T>
5858
A(T&&... args);
5959
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructors that are callable with a single argument
60-
// CHECK-FIXES: {{^ }}explicit A(T&&... args);
60+
// CHECK-FIXES: explicit A(T&&... args);
6161
};
6262

6363
inline A::A(int x1) {}
@@ -69,23 +69,23 @@ struct B {
6969

7070
operator bool() const { return true; }
7171
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator bool' must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
72-
// CHECK-FIXES: {{^ }}explicit operator bool() const { return true; }
72+
// CHECK-FIXES: explicit operator bool() const { return true; }
7373

7474
operator double() const;
7575
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator double' must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
76-
// CHECK-FIXES: {{^ }}explicit operator double() const;
76+
// CHECK-FIXES: explicit operator double() const;
7777

7878
explicit B(::std::initializer_list<double> list4) {}
7979
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: initializer-list constructor should not be declared explicit [google-explicit-constructor]
80-
// CHECK-FIXES: {{^ }}B(::std::initializer_list<double> list4) {}
80+
// CHECK-FIXES: B(::std::initializer_list<double> list4) {}
8181

8282
explicit B(const ::std::initializer_list<char> &list5) {}
8383
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: initializer-list constructor
84-
// CHECK-FIXES: {{^ }}B(const ::std::initializer_list<char> &list5) {}
84+
// CHECK-FIXES: B(const ::std::initializer_list<char> &list5) {}
8585

8686
explicit B(::std::initializer_list<char> &&list6) {}
8787
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: initializer-list constructor
88-
// CHECK-FIXES: {{^ }}B(::std::initializer_list<char> &&list6) {}
88+
// CHECK-FIXES: B(::std::initializer_list<char> &&list6) {}
8989
};
9090

9191
inline B::operator double() const { return 0.0; }
@@ -110,7 +110,7 @@ struct C2 {
110110

111111
explicit C2(initializer_list<double> list4) {}
112112
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: initializer-list constructor
113-
// CHECK-FIXES: {{^ }}C2(initializer_list<double> list4) {}
113+
// CHECK-FIXES: C2(initializer_list<double> list4) {}
114114
};
115115

116116
template <typename T>
@@ -132,11 +132,11 @@ template <typename T>
132132
struct E {
133133
E(T *pt) {}
134134
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: single-argument constructors
135-
// CHECK-FIXES: {{^ }}explicit E(T *pt) {}
135+
// CHECK-FIXES: explicit E(T *pt) {}
136136
template <typename U>
137137
E(U *pu) {}
138138
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: single-argument constructors
139-
// CHECK-FIXES: {{^ }}explicit E(U *pu) {}
139+
// CHECK-FIXES: explicit E(U *pu) {}
140140

141141
explicit E(T t) {}
142142
template <typename U>
@@ -156,14 +156,14 @@ template<typename T>
156156
struct G {
157157
operator bool() const;
158158
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator bool' must be marked
159-
// CHECK-FIXES: {{^}} explicit operator bool() const;
159+
// CHECK-FIXES: explicit operator bool() const;
160160
operator F<T>() const;
161161
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator F<type-parameter-0-0>' must be marked
162-
// CHECK-FIXES: {{^}} explicit operator F<T>() const;
162+
// CHECK-FIXES: explicit operator F<T>() const;
163163
template<typename U>
164164
operator F<U>*() const;
165165
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator F<type-parameter-1-0> *' must be marked
166-
// CHECK-FIXES: {{^}} explicit operator F<U>*() const;
166+
// CHECK-FIXES: explicit operator F<U>*() const;
167167
};
168168

169169
void f2() {

clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,4 @@ constexpr bool f13<void, int> = false;
203203

204204
int main() {}
205205
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'main' defined in a header file;
206-
// CHECK-FIXES: {{^}}int main() {
206+
// CHECK-FIXES: int main() {}

clang-tools-extra/test/clang-tidy/checkers/misc/static-assert.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ void abort(void) {}
1313
void f(void) {
1414
int x = 1;
1515
assert(x == 0);
16-
// CHECK-FIXES: {{^ }}assert(x == 0);
16+
// CHECK-FIXES: assert(x == 0);
1717

1818
#define static_assert(x, msg) _Static_assert(x, msg)
1919
assert(11 == 5 + 6);
2020
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be
21-
// CHECK-FIXES: {{^ }}static_assert(11 == 5 + 6, "");
21+
// CHECK-FIXES: static_assert(11 == 5 + 6, "");
2222
#undef static_assert
2323

2424
assert(10 == 5 + 5);
2525
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be
26-
// CHECK-FIXES: {{^ }}static_assert(10 == 5 + 5, "");
26+
// CHECK-FIXES: static_assert(10 == 5 + 5, "");
2727
}

clang-tools-extra/test/clang-tidy/checkers/misc/unused-alias-decls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class C {};
66

77
namespace unused_alias = ::my_namespace; // eol-comments aren't removed (yet)
88
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: namespace alias decl 'unused_alias' is unused
9-
// CHECK-FIXES: {{^}}// eol-comments aren't removed (yet)
9+
// CHECK-FIXES: // eol-comments aren't removed (yet)
1010

1111
namespace used_alias = ::my_namespace;
1212
void f() { used_alias::C c; }

clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ T ff() { T t; return t; }
8282
using n::A; // A
8383
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'A' is unused
8484
// CHECK-MESSAGES: :[[@LINE-2]]:10: note: remove the using
85-
// CHECK-FIXES: {{^}}// A
85+
// CHECK-FIXES: // A
8686
using n::B;
8787
using n::C;
8888
using n::D;
8989
using n::E; // E
9090
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'E' is unused
91-
// CHECK-FIXES: {{^}}// E
91+
// CHECK-FIXES: // E
9292
using n::F;
9393
using n::G;
9494
using n::H;
@@ -103,10 +103,10 @@ using n::UsedFunc;
103103
using n::UsedTemplateFunc;
104104
using n::UnusedInstance; // UnusedInstance
105105
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'UnusedInstance' is unused
106-
// CHECK-FIXES: {{^}}// UnusedInstance
106+
// CHECK-FIXES: // UnusedInstance
107107
using n::UnusedFunc; // UnusedFunc
108108
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'UnusedFunc' is unused
109-
// CHECK-FIXES: {{^}}// UnusedFunc
109+
// CHECK-FIXES: // UnusedFunc
110110
using n::operator""_w;
111111
using n::cout;
112112
using n::endl;
@@ -120,7 +120,7 @@ template <typename T> void Callee() {
120120

121121
using n::OverloadFunc; // OverloadFunc
122122
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'OverloadFunc' is unused
123-
// CHECK-FIXES: {{^}}// OverloadFunc
123+
// CHECK-FIXES: // OverloadFunc
124124

125125
#define DEFINE_INT(name) \
126126
namespace INT { \

clang-tools-extra/test/clang-tidy/checkers/modernize/raw-string-literal-delimiter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
char const *const ContainsSentinel{"who\\ops)\""};
44
// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: {{.*}} can be written as a raw string literal
5-
// CHECK-FIXES: {{^}}char const *const ContainsSentinel{R"str(who\ops)")str"};{{$}}
5+
// CHECK-FIXES: char const *const ContainsSentinel{R"str(who\ops)")str"};
66

77
//char const *const ContainsDelim{"whoops)\")lit\""};
88
// CHECK-XMESSAGES: :[[@LINE-1]]:33: warning: {{.*}} can be written as a raw string literal
9-
// CHECK-XFIXES: {{^}}char const *const ContainsDelim{R"lit1(whoops)")lit")lit1"};{{$}}
9+
// CHECK-XFIXES: char const *const ContainsDelim{R"lit1(whoops)")lit")lit1"};

clang-tools-extra/test/clang-tidy/checkers/modernize/raw-string-literal-replace-shorter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ char const *const NeedDelimiter("\":)\"");
66

77
char const *const ManyQuotes("quotes:\'\'\'\'");
88
// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: {{.*}} can be written as a raw string literal
9-
// CHECK-FIXES: {{^}}char const *const ManyQuotes(R"(quotes:'''')");{{$}}
9+
// CHECK-FIXES: char const *const ManyQuotes(R"(quotes:'''')");
1010

1111
char const *const LongOctal("\042\072\051\042");
1212
// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: {{.*}} can be written as a raw string literal
13-
// CHECK-FIXES: {{^}}char const *const LongOctal(R"lit(":)")lit");{{$}}
13+
// CHECK-FIXES: char const *const LongOctal(R"lit(":)")lit");

clang-tools-extra/test/clang-tidy/checkers/modernize/shrink-to-fit.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,53 @@ void f() {
99

1010
std::vector<int>(v).swap(v);
1111
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should be used to reduce the capacity of a shrinkable container [modernize-shrink-to-fit]
12-
// CHECK-FIXES: {{^ }}v.shrink_to_fit();{{$}}
12+
// CHECK-FIXES: v.shrink_to_fit();
1313

1414
std::vector<int> &vref = v;
1515
std::vector<int>(vref).swap(vref);
1616
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should
17-
// CHECK-FIXES: {{^ }}vref.shrink_to_fit();{{$}}
17+
// CHECK-FIXES: vref.shrink_to_fit();
1818

1919
std::vector<int> *vptr = &v;
2020
std::vector<int>(*vptr).swap(*vptr);
2121
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should
22-
// CHECK-FIXES: {{^ }}vptr->shrink_to_fit();{{$}}
22+
// CHECK-FIXES: vptr->shrink_to_fit();
2323
}
2424

2525
struct X {
2626
std::vector<int> v;
2727
void f() {
2828
std::vector<int>(v).swap(v);
2929
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: the shrink_to_fit method should
30-
// CHECK-FIXES: {{^ }}v.shrink_to_fit();{{$}}
30+
// CHECK-FIXES: v.shrink_to_fit();
3131

3232
std::vector<int> *vptr = &v;
3333
std::vector<int>(*vptr).swap(*vptr);
3434
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: the shrink_to_fit method should
35-
// CHECK-FIXES: {{^ }}vptr->shrink_to_fit();{{$}}
35+
// CHECK-FIXES: vptr->shrink_to_fit();
3636
}
3737
};
3838

3939
template <typename T> void g() {
4040
std::vector<int> v;
4141
std::vector<int>(v).swap(v);
4242
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should
43-
// CHECK-FIXES: {{^ }}v.shrink_to_fit();{{$}}
43+
// CHECK-FIXES: v.shrink_to_fit();
4444

4545
std::vector<T> v2;
4646
std::vector<T>(v2).swap(v2);
47-
// CHECK-FIXES: {{^ }}std::vector<T>(v2).swap(v2);{{$}}
47+
// CHECK-FIXES: std::vector<T>(v2).swap(v2);
4848
}
4949

5050
template <typename T> void g2() {
5151
std::vector<int> v;
5252
std::vector<int>(v).swap(v);
5353
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should
54-
// CHECK-FIXES: {{^ }}v.shrink_to_fit();{{$}}
54+
// CHECK-FIXES: v.shrink_to_fit();
5555

5656
T v3;
5757
T(v3).swap(v3);
58-
// CHECK-FIXES: {{^ }}T(v3).swap(v3);{{$}}
58+
// CHECK-FIXES: T(v3).swap(v3);
5959
}
6060

6161
#define COPY_AND_SWAP_INT_VEC(x) std::vector<int>(x).swap(x)
@@ -69,19 +69,19 @@ void h() {
6969
std::vector<int> v;
7070
COPY_AND_SWAP_INT_VEC(v);
7171
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should
72-
// CHECK-FIXES: {{^ }}COPY_AND_SWAP_INT_VEC(v);{{$}}
72+
// CHECK-FIXES: COPY_AND_SWAP_INT_VEC(v);
7373
}
7474

7575
void PR38315() {
7676
typedef std::vector<int> Vector;
7777
Vector v;
7878
Vector(v).swap(v);
7979
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should
80-
// CHECK-FIXES: {{^ }}v.shrink_to_fit();{{$}}
80+
// CHECK-FIXES: v.shrink_to_fit();
8181

8282
using Vector2 = std::vector<int>;
8383
Vector2 v2;
8484
Vector2(v2).swap(v2);
8585
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: the shrink_to_fit method should
86-
// CHECK-FIXES: {{^ }}v2.shrink_to_fit();{{$}}
86+
// CHECK-FIXES: v2.shrink_to_fit();
8787
}

clang-tools-extra/test/clang-tidy/checkers/modernize/use-transparent-functors.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,18 @@ int main() {
7575
using std::less;
7676
std::set<int, std::less<int>> s;
7777
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: prefer transparent functors 'less<>' [modernize-use-transparent-functors]
78-
// CHECK-FIXES: {{^}} std::set<int, std::less<>> s;{{$}}
78+
// CHECK-FIXES: std::set<int, std::less<>> s;
7979
set<int, std::less<int>> s2;
8080
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: prefer transparent functors
81-
// CHECK-FIXES: {{^}} set<int, std::less<>> s2;{{$}}
81+
// CHECK-FIXES: set<int, std::less<>> s2;
8282
set<int, less<int>> s3;
8383
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: prefer transparent functors
84-
// CHECK-FIXES: {{^}} set<int, less<>> s3;{{$}}
84+
// CHECK-FIXES: set<int, less<>> s3;
8585
std::set<int, std::less<>> s4;
8686
std::set<char *, std::less<std::string>> s5;
8787
std::set<set<int, less<int>>, std::less<>> s6;
8888
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: prefer transparent functors
89-
// CHECK-FIXES: {{^}} std::set<set<int, less<>>, std::less<>> s6;{{$}}
89+
// CHECK-FIXES: std::set<set<int, less<>>, std::less<>> s6;
9090
std::iterator begin, end;
9191
sort(begin, end, std::less<int>());
9292
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: prefer transparent functors
@@ -96,7 +96,7 @@ int main() {
9696
std::find_if(begin, end, std::logical_not<>());
9797
using my_set = std::set<int, std::less<int>>;
9898
// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: prefer transparent functors
99-
// CHECK-FIXES: {{^}} using my_set = std::set<int, std::less<>>;{{$}}
99+
// CHECK-FIXES: using my_set = std::set<int, std::less<>>;
100100
using my_set2 = std::set<char*, std::less<std::string>>;
101101
using my_less = std::less<std::string>;
102102
find_if(begin, end, my_less());

clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %check_clang_tidy --match-partial-fixes %s modernize-use-using %t -- -- -fno-delayed-template-parsing -I %S/Inputs/use-using/
1+
// RUN: %check_clang_tidy %s modernize-use-using %t -- -- -fno-delayed-template-parsing -I %S/Inputs/use-using/
22

33
typedef int Type;
44
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
@@ -265,7 +265,7 @@ class Variadic {};
265265

266266
typedef Variadic<Variadic<int, bool, Q<T{0 < 0}.b> >, S<(0 < 0), Variadic<Q<b[0 < 0]> > > > Variadic_t;
267267
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
268-
// CHECK-FIXES: using Variadic_t = Variadic<Variadic<int, bool, Q<T{0 < 0}.b> >, S<(0 < 0), Variadic<Q<b[0 < 0]> > > >
268+
// CHECK-FIXES: using Variadic_t = Variadic<Variadic<int, bool, Q<T{0 < 0}.b> >, S<(0 < 0), Variadic<Q<b[0 < 0]> > > >;
269269

270270
typedef Variadic<Variadic<int, bool, Q<T{0 < 0}.b> >, S<(0 < 0), Variadic<Q<b[0 < 0]> > > > Variadic_t, *Variadic_p;
271271
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
@@ -319,8 +319,8 @@ typedef void (*ISSUE_65055_1)(int);
319319
typedef bool (*ISSUE_65055_2)(int);
320320
// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use 'using' instead of 'typedef'
321321
// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use 'using' instead of 'typedef'
322-
// CHECK-FIXES: {{^}}using ISSUE_65055_1 = void (*)(int);{{$}}
323-
// CHECK-FIXES: {{^}}using ISSUE_65055_2 = bool (*)(int);{{$}}
322+
// CHECK-FIXES: using ISSUE_65055_1 = void (*)(int);
323+
// CHECK-FIXES: using ISSUE_65055_2 = bool (*)(int);
324324

325325
typedef class ISSUE_67529_1 *ISSUE_67529;
326326
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'

0 commit comments

Comments
 (0)