Skip to content

Commit 63662d8

Browse files
Merge branch 'llvm:main' into 3-acc-common
2 parents 553a3c3 + 57726bd commit 63662d8

File tree

434 files changed

+10152
-5006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

434 files changed

+10152
-5006
lines changed

.ci/metrics/metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
GITHUB_JOB_TO_TRACK = {
4141
"github_llvm_premerge_checks": {
4242
"Build and Test Linux": "premerge_linux",
43+
"Build and Test Linux AArch64": "premerge_linux_aarch64",
4344
"Build and Test Windows": "premerge_windows",
4445
},
4546
"github_libcxx_premerge_checks": {

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,16 +1040,11 @@ class ExplicitReferenceCollector
10401040
if (auto *S = N.get<Stmt>())
10411041
return refInStmt(S, Resolver);
10421042
if (auto *NNSL = N.get<NestedNameSpecifierLoc>()) {
1043+
if (auto TL = NNSL->getAsTypeLoc())
1044+
return refInTypeLoc(NNSL->getAsTypeLoc(), Resolver);
10431045
// (!) 'DeclRelation::Alias' ensures we do not lose namespace aliases.
1044-
NestedNameSpecifierLoc Qualifier;
1045-
SourceLocation NameLoc;
1046-
if (auto TL = NNSL->getAsTypeLoc()) {
1047-
Qualifier = TL.getPrefix();
1048-
NameLoc = TL.getNonPrefixBeginLoc();
1049-
} else {
1050-
Qualifier = NNSL->getAsNamespaceAndPrefix().Prefix;
1051-
NameLoc = NNSL->getLocalBeginLoc();
1052-
}
1046+
NestedNameSpecifierLoc Qualifier = NNSL->getAsNamespaceAndPrefix().Prefix;
1047+
SourceLocation NameLoc = NNSL->getLocalBeginLoc();
10531048
return {
10541049
ReferenceLoc{Qualifier, NameLoc, false,
10551050
explicitReferenceTargets(

clang-tools-extra/test/clang-tidy/checkers/abseil/duration-addition.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %check_clang_tidy --match-partial-fixes %s abseil-duration-addition %t -- -- -I%S/Inputs
1+
// RUN: %check_clang_tidy %s abseil-duration-addition %t -- -- -I%S/Inputs
22

33
#include "absl/time/time.h"
44

@@ -8,68 +8,68 @@ void f() {
88

99
i = absl::ToUnixHours(t) + 5;
1010
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
11-
// CHECK-FIXES: absl::ToUnixHours(t + absl::Hours(5))
11+
// CHECK-FIXES: i = absl::ToUnixHours(t + absl::Hours(5));
1212
i = absl::ToUnixMinutes(t) + 5;
1313
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
14-
// CHECK-FIXES: absl::ToUnixMinutes(t + absl::Minutes(5))
14+
// CHECK-FIXES: i = absl::ToUnixMinutes(t + absl::Minutes(5));
1515
i = absl::ToUnixSeconds(t) + 5;
1616
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
17-
// CHECK-FIXES: absl::ToUnixSeconds(t + absl::Seconds(5))
17+
// CHECK-FIXES: i = absl::ToUnixSeconds(t + absl::Seconds(5));
1818
i = absl::ToUnixMillis(t) + 5;
1919
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
20-
// CHECK-FIXES: absl::ToUnixMillis(t + absl::Milliseconds(5))
20+
// CHECK-FIXES: i = absl::ToUnixMillis(t + absl::Milliseconds(5));
2121
i = absl::ToUnixMicros(t) + 5;
2222
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
23-
// CHECK-FIXES: absl::ToUnixMicros(t + absl::Microseconds(5))
23+
// CHECK-FIXES: i = absl::ToUnixMicros(t + absl::Microseconds(5));
2424
i = absl::ToUnixNanos(t) + 5;
2525
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
26-
// CHECK-FIXES: absl::ToUnixNanos(t + absl::Nanoseconds(5))
26+
// CHECK-FIXES: i = absl::ToUnixNanos(t + absl::Nanoseconds(5));
2727

2828
i = 3 + absl::ToUnixHours(t);
2929
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
30-
// CHECK-FIXES: absl::ToUnixHours(absl::Hours(3) + t)
30+
// CHECK-FIXES: i = absl::ToUnixHours(absl::Hours(3) + t);
3131
i = 3 + absl::ToUnixMinutes(t);
3232
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
33-
// CHECK-FIXES: absl::ToUnixMinutes(absl::Minutes(3) + t)
33+
// CHECK-FIXES: i = absl::ToUnixMinutes(absl::Minutes(3) + t);
3434
i = 3 + absl::ToUnixSeconds(t);
3535
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
36-
// CHECK-FIXES: absl::ToUnixSeconds(absl::Seconds(3) + t)
36+
// CHECK-FIXES: i = absl::ToUnixSeconds(absl::Seconds(3) + t);
3737
i = 3 + absl::ToUnixMillis(t);
3838
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
39-
// CHECK-FIXES: absl::ToUnixMillis(absl::Milliseconds(3) + t)
39+
// CHECK-FIXES: i = absl::ToUnixMillis(absl::Milliseconds(3) + t);
4040
i = 3 + absl::ToUnixMicros(t);
4141
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
42-
// CHECK-FIXES: absl::ToUnixMicros(absl::Microseconds(3) + t)
42+
// CHECK-FIXES: i = absl::ToUnixMicros(absl::Microseconds(3) + t);
4343
i = 3 + absl::ToUnixNanos(t);
4444
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
45-
// CHECK-FIXES: absl::ToUnixNanos(absl::Nanoseconds(3) + t)
45+
// CHECK-FIXES: i = absl::ToUnixNanos(absl::Nanoseconds(3) + t);
4646

4747
// Undoing inverse conversions
4848
i = absl::ToUnixMicros(t) + absl::ToInt64Microseconds(absl::Seconds(1));
4949
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
50-
// CHECK-FIXES: absl::ToUnixMicros(t + absl::Seconds(1))
50+
// CHECK-FIXES: i = absl::ToUnixMicros(t + absl::Seconds(1));
5151

5252
// Parens
5353
i = 3 + (absl::ToUnixHours(t));
5454
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
55-
// CHECK-FIXES: absl::ToUnixHours(absl::Hours(3) + t)
55+
// CHECK-FIXES: i = absl::ToUnixHours(absl::Hours(3) + t);
5656

5757
// Float folding
5858
i = absl::ToUnixSeconds(t) + 5.0;
5959
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
60-
// CHECK-FIXES: absl::ToUnixSeconds(t + absl::Seconds(5))
60+
// CHECK-FIXES: i = absl::ToUnixSeconds(t + absl::Seconds(5));
6161

6262
// We can rewrite the argument of the duration conversion
6363
#define THIRTY absl::FromUnixSeconds(30)
6464
i = absl::ToUnixSeconds(THIRTY) + 1;
6565
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
66-
// CHECK-FIXES: absl::ToUnixSeconds(THIRTY + absl::Seconds(1))
66+
// CHECK-FIXES: i = absl::ToUnixSeconds(THIRTY + absl::Seconds(1));
6767
#undef THIRTY
6868

6969
// Some other contexts
7070
if (absl::ToUnixSeconds(t) + 1.0 > 10) {}
7171
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
72-
// CHECK-FIXES: absl::ToUnixSeconds(t + absl::Seconds(1))
72+
// CHECK-FIXES: if (absl::ToUnixSeconds(t + absl::Seconds(1)) > 10) {}
7373

7474
// These should not match
7575
i = 5 + 6;
@@ -88,7 +88,7 @@ template<typename T>
8888
void foo(absl::Time t) {
8989
int i = absl::ToUnixNanos(t) + T{};
9090
// CHECK-MESSAGES: [[@LINE-1]]:11: warning: perform addition in the duration domain [abseil-duration-addition]
91-
// CHECK-FIXES: absl::ToUnixNanos(t + absl::Nanoseconds(T{}))
91+
// CHECK-FIXES: int i = absl::ToUnixNanos(t + absl::Nanoseconds(T{}));
9292
}
9393

9494
void g() {

clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %check_clang_tidy --match-partial-fixes %s abseil-duration-comparison %t -- -- -I%S/Inputs
1+
// RUN: %check_clang_tidy %s abseil-duration-comparison %t -- -- -I%S/Inputs
22

33
#include "absl/time/time.h"
44

@@ -11,104 +11,104 @@ void f() {
1111
// Check against the RHS
1212
b = x > absl::ToDoubleSeconds(d1);
1313
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
14-
// CHECK-FIXES: absl::Seconds(x) > d1;
14+
// CHECK-FIXES: b = absl::Seconds(x) > d1;
1515
b = x >= absl::ToDoubleSeconds(d1);
1616
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
17-
// CHECK-FIXES: absl::Seconds(x) >= d1;
17+
// CHECK-FIXES: b = absl::Seconds(x) >= d1;
1818
b = x == absl::ToDoubleSeconds(d1);
1919
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
20-
// CHECK-FIXES: absl::Seconds(x) == d1;
20+
// CHECK-FIXES: b = absl::Seconds(x) == d1;
2121
b = x <= absl::ToDoubleSeconds(d1);
2222
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
23-
// CHECK-FIXES: absl::Seconds(x) <= d1;
23+
// CHECK-FIXES: b = absl::Seconds(x) <= d1;
2424
b = x < absl::ToDoubleSeconds(d1);
2525
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
26-
// CHECK-FIXES: absl::Seconds(x) < d1;
26+
// CHECK-FIXES: b = absl::Seconds(x) < d1;
2727
b = x == absl::ToDoubleSeconds(t1 - t2);
2828
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
29-
// CHECK-FIXES: absl::Seconds(x) == t1 - t2;
29+
// CHECK-FIXES: b = absl::Seconds(x) == t1 - t2;
3030
b = absl::ToDoubleSeconds(d1) > absl::ToDoubleSeconds(d2);
3131
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
32-
// CHECK-FIXES: d1 > d2;
32+
// CHECK-FIXES: b = d1 > d2;
3333

3434
// Check against the LHS
3535
b = absl::ToDoubleSeconds(d1) < x;
3636
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
37-
// CHECK-FIXES: d1 < absl::Seconds(x);
37+
// CHECK-FIXES: b = d1 < absl::Seconds(x);
3838
b = absl::ToDoubleSeconds(d1) <= x;
3939
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
40-
// CHECK-FIXES: d1 <= absl::Seconds(x);
40+
// CHECK-FIXES: b = d1 <= absl::Seconds(x);
4141
b = absl::ToDoubleSeconds(d1) == x;
4242
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
43-
// CHECK-FIXES: d1 == absl::Seconds(x);
43+
// CHECK-FIXES: b = d1 == absl::Seconds(x);
4444
b = absl::ToDoubleSeconds(d1) >= x;
4545
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
46-
// CHECK-FIXES: d1 >= absl::Seconds(x);
46+
// CHECK-FIXES: b = d1 >= absl::Seconds(x);
4747
b = absl::ToDoubleSeconds(d1) > x;
4848
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
49-
// CHECK-FIXES: d1 > absl::Seconds(x);
49+
// CHECK-FIXES: b = d1 > absl::Seconds(x);
5050

5151
// Comparison against zero
5252
b = absl::ToDoubleSeconds(d1) < 0.0;
5353
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
54-
// CHECK-FIXES: d1 < absl::ZeroDuration();
54+
// CHECK-FIXES: b = d1 < absl::ZeroDuration();
5555
b = absl::ToDoubleSeconds(d1) < 0;
5656
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
57-
// CHECK-FIXES: d1 < absl::ZeroDuration();
57+
// CHECK-FIXES: b = d1 < absl::ZeroDuration();
5858

5959
// Scales other than Seconds
6060
b = x > absl::ToDoubleMicroseconds(d1);
6161
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
62-
// CHECK-FIXES: absl::Microseconds(x) > d1;
62+
// CHECK-FIXES: b = absl::Microseconds(x) > d1;
6363
b = x >= absl::ToDoubleMilliseconds(d1);
6464
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
65-
// CHECK-FIXES: absl::Milliseconds(x) >= d1;
65+
// CHECK-FIXES: b = absl::Milliseconds(x) >= d1;
6666
b = x == absl::ToDoubleNanoseconds(d1);
6767
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
68-
// CHECK-FIXES: absl::Nanoseconds(x) == d1;
68+
// CHECK-FIXES: b = absl::Nanoseconds(x) == d1;
6969
b = x <= absl::ToDoubleMinutes(d1);
7070
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
71-
// CHECK-FIXES: absl::Minutes(x) <= d1;
71+
// CHECK-FIXES: b = absl::Minutes(x) <= d1;
7272
b = x < absl::ToDoubleHours(d1);
7373
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
74-
// CHECK-FIXES: absl::Hours(x) < d1;
74+
// CHECK-FIXES: b = absl::Hours(x) < d1;
7575

7676
// Integer comparisons
7777
b = x > absl::ToInt64Microseconds(d1);
7878
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
79-
// CHECK-FIXES: absl::Microseconds(x) > d1;
79+
// CHECK-FIXES: b = absl::Microseconds(x) > d1;
8080
b = x >= absl::ToInt64Milliseconds(d1);
8181
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
82-
// CHECK-FIXES: absl::Milliseconds(x) >= d1;
82+
// CHECK-FIXES: b = absl::Milliseconds(x) >= d1;
8383
b = x == absl::ToInt64Nanoseconds(d1);
8484
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
85-
// CHECK-FIXES: absl::Nanoseconds(x) == d1;
85+
// CHECK-FIXES: b = absl::Nanoseconds(x) == d1;
8686
b = x == absl::ToInt64Seconds(d1);
8787
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
88-
// CHECK-FIXES: absl::Seconds(x) == d1;
88+
// CHECK-FIXES: b = absl::Seconds(x) == d1;
8989
b = x <= absl::ToInt64Minutes(d1);
9090
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
91-
// CHECK-FIXES: absl::Minutes(x) <= d1;
91+
// CHECK-FIXES: b = absl::Minutes(x) <= d1;
9292
b = x < absl::ToInt64Hours(d1);
9393
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
94-
// CHECK-FIXES: absl::Hours(x) < d1;
94+
// CHECK-FIXES: b = absl::Hours(x) < d1;
9595

9696
// Other abseil-duration checks folded into this one
9797
b = static_cast<double>(5) > absl::ToDoubleSeconds(d1);
9898
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
99-
// CHECK-FIXES: absl::Seconds(5) > d1;
99+
// CHECK-FIXES: b = absl::Seconds(5) > d1;
100100
b = double(5) > absl::ToDoubleSeconds(d1);
101101
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
102-
// CHECK-FIXES: absl::Seconds(5) > d1;
102+
// CHECK-FIXES: b = absl::Seconds(5) > d1;
103103
b = float(5) > absl::ToDoubleSeconds(d1);
104104
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
105-
// CHECK-FIXES: absl::Seconds(5) > d1;
105+
// CHECK-FIXES: b = absl::Seconds(5) > d1;
106106
b = ((double)5) > absl::ToDoubleSeconds(d1);
107107
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
108-
// CHECK-FIXES: absl::Seconds(5) > d1;
108+
// CHECK-FIXES: b = absl::Seconds(5) > d1;
109109
b = 5.0 > absl::ToDoubleSeconds(d1);
110110
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
111-
// CHECK-FIXES: absl::Seconds(5) > d1;
111+
// CHECK-FIXES: b = absl::Seconds(5) > d1;
112112

113113
// A long expression
114114
bool some_condition;
@@ -125,20 +125,20 @@ void f() {
125125
int y;
126126
b = (y + 5) * 10 > absl::ToDoubleMilliseconds(d1);
127127
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
128-
// CHECK-FIXES: absl::Milliseconds((y + 5) * 10) > d1;
128+
// CHECK-FIXES: b = absl::Milliseconds((y + 5) * 10) > d1;
129129

130130
// We should still transform the expression inside this macro invocation
131131
#define VALUE_IF(v, e) v ? (e) : 0
132132
int a = VALUE_IF(1, 5 > absl::ToDoubleSeconds(d1));
133133
// CHECK-MESSAGES: [[@LINE-1]]:23: warning: perform comparison in the duration domain [abseil-duration-comparison]
134-
// CHECK-FIXES: VALUE_IF(1, absl::Seconds(5) > d1);
134+
// CHECK-FIXES: int a = VALUE_IF(1, absl::Seconds(5) > d1);
135135
#undef VALUE_IF
136136

137137
#define VALUE_IF_2(e) (e)
138138
#define VALUE_IF(v, e) v ? VALUE_IF_2(e) : VALUE_IF_2(0)
139139
int a2 = VALUE_IF(1, 5 > absl::ToDoubleSeconds(d1));
140140
// CHECK-MESSAGES: [[@LINE-1]]:24: warning: perform comparison in the duration domain [abseil-duration-comparison]
141-
// CHECK-FIXES: VALUE_IF(1, absl::Seconds(5) > d1);
141+
// CHECK-FIXES: int a2 = VALUE_IF(1, absl::Seconds(5) > d1);
142142
#undef VALUE_IF
143143
#undef VALUE_IF_2
144144

0 commit comments

Comments
 (0)