Skip to content

Commit fd26016

Browse files
Merge remote-tracking branch 'upstream/main' into vinay-issue-119281-wextra
2 parents 06111d2 + ca9ec7d commit fd26016

File tree

350 files changed

+7508
-5395
lines changed

Some content is hidden

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

350 files changed

+7508
-5395
lines changed

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
555555
.addReg(RegCnt);
556556
}
557557

558-
InstructionListType createCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
559-
const MCSymbol *Target,
560-
MCContext *Ctx) const {
558+
InstructionListType createRegCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
559+
const MCSymbol *Target,
560+
MCContext *Ctx) const {
561561
InstructionListType Insts;
562562
Insts.emplace_back(
563563
MCInstBuilder(RISCV::SUB).addReg(RegTmp).addReg(RegNo).addReg(RegNo));
@@ -718,7 +718,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
718718
Insts.emplace_back();
719719
loadReg(Insts.back(), RISCV::X10, RISCV::X10, 0);
720720
InstructionListType cmpJmp =
721-
createCmpJE(RISCV::X10, RISCV::X11, IndCallHandler, Ctx);
721+
createRegCmpJE(RISCV::X10, RISCV::X11, IndCallHandler, Ctx);
722722
Insts.insert(Insts.end(), cmpJmp.begin(), cmpJmp.end());
723723
Insts.emplace_back();
724724
createStackPointerIncrement(Insts.back(), 16);
@@ -777,14 +777,13 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
777777
return createGetter(Ctx, "__bolt_instr_num_funcs");
778778
}
779779

780-
void convertIndirectCallToLoad(MCInst &Inst, MCPhysReg Reg,
781-
MCPhysReg ZeroReg) const {
780+
void convertIndirectCallToLoad(MCInst &Inst, MCPhysReg Reg) override {
782781
bool IsTailCall = isTailCall(Inst);
783782
if (IsTailCall)
784783
removeAnnotation(Inst, MCPlus::MCAnnotation::kTailCall);
785784
Inst.setOpcode(RISCV::ADD);
786785
Inst.insert(Inst.begin(), MCOperand::createReg(Reg));
787-
Inst.insert(Inst.begin() + 1, MCOperand::createReg(ZeroReg));
786+
Inst.insert(Inst.begin() + 1, MCOperand::createReg(RISCV::X0));
788787
return;
789788
}
790789

@@ -845,7 +844,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
845844
InstructionListType Insts;
846845
spillRegs(Insts, {RISCV::X10, RISCV::X11});
847846
Insts.emplace_back(CallInst);
848-
convertIndirectCallToLoad(Insts.back(), RISCV::X10, RISCV::X0);
847+
convertIndirectCallToLoad(Insts.back(), RISCV::X10);
849848
InstructionListType LoadImm = createLoadImmediate(RISCV::X11, CallSiteID);
850849
Insts.insert(Insts.end(), LoadImm.begin(), LoadImm.end());
851850
spillRegs(Insts, {RISCV::X10, RISCV::X11});

clang-tools-extra/pp-trace/PPCallbacksTracker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ void PPCallbacksTracker::appendArgument(const char *Name, ModuleIdPath Value) {
547547
if (I)
548548
SS << ", ";
549549
SS << "{"
550-
<< "Name: " << Value[I].first->getName() << ", "
551-
<< "Loc: " << getSourceLocationString(PP, Value[I].second) << "}";
550+
<< "Name: " << Value[I].getIdentifierInfo()->getName() << ", "
551+
<< "Loc: " << getSourceLocationString(PP, Value[I].getLoc()) << "}";
552552
}
553553
SS << "]";
554554
appendArgument(Name, SS.str());

clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-startswith.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,67 +29,67 @@ std::string bar();
2929
void tests(std::string s, global_string s2, std::string_view sv) {
3030
s.find("a") == 0;
3131
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith instead of find() == 0 [abseil-string-find-startswith]
32-
// CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, "a");{{$}}
32+
// CHECK-FIXES: absl::StartsWith(s, "a");
3333

3434
s.find(s) == 0;
3535
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
36-
// CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, s);{{$}}
36+
// CHECK-FIXES: absl::StartsWith(s, s);
3737

3838
s.find("aaa") != 0;
3939
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
40-
// CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "aaa");{{$}}
40+
// CHECK-FIXES: !absl::StartsWith(s, "aaa");
4141

4242
s.find(foo(foo(bar()))) != 0;
4343
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
44-
// CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, foo(foo(bar())));{{$}}
44+
// CHECK-FIXES: !absl::StartsWith(s, foo(foo(bar())));
4545

4646
if (s.find("....") == 0) { /* do something */ }
4747
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use absl::StartsWith
48-
// CHECK-FIXES: {{^[[:space:]]*}}if (absl::StartsWith(s, "....")) { /* do something */ }{{$}}
48+
// CHECK-FIXES: if (absl::StartsWith(s, "....")) { /* do something */ }
4949

5050
0 != s.find("a");
5151
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
52-
// CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "a");{{$}}
52+
// CHECK-FIXES: !absl::StartsWith(s, "a");
5353

5454
s2.find("a") == 0;
5555
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
56-
// CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s2, "a");{{$}}
56+
// CHECK-FIXES: absl::StartsWith(s2, "a");
5757

5858
s.rfind("a", 0) == 0;
5959
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith instead of rfind() == 0 [abseil-string-find-startswith]
60-
// CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, "a");{{$}}
60+
// CHECK-FIXES: absl::StartsWith(s, "a");
6161

6262
s.rfind(s, 0) == 0;
6363
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
64-
// CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s, s);{{$}}
64+
// CHECK-FIXES: absl::StartsWith(s, s);
6565

6666
s.rfind("aaa", 0) != 0;
6767
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
68-
// CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "aaa");{{$}}
68+
// CHECK-FIXES: !absl::StartsWith(s, "aaa");
6969

7070
s.rfind(foo(foo(bar())), 0) != 0;
7171
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
72-
// CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, foo(foo(bar())));{{$}}
72+
// CHECK-FIXES: !absl::StartsWith(s, foo(foo(bar())));
7373

7474
if (s.rfind("....", 0) == 0) { /* do something */ }
7575
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use absl::StartsWith
76-
// CHECK-FIXES: {{^[[:space:]]*}}if (absl::StartsWith(s, "....")) { /* do something */ }{{$}}
76+
// CHECK-FIXES: if (absl::StartsWith(s, "....")) { /* do something */ }
7777

7878
0 != s.rfind("a", 0);
7979
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
80-
// CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(s, "a");{{$}}
80+
// CHECK-FIXES: !absl::StartsWith(s, "a");
8181

8282
s2.rfind("a", 0) == 0;
8383
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
84-
// CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(s2, "a");{{$}}
84+
// CHECK-FIXES: absl::StartsWith(s2, "a");
8585

8686
sv.find("a") == 0;
8787
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use absl::StartsWith
88-
// CHECK-FIXES: {{^[[:space:]]*}}absl::StartsWith(sv, "a");{{$}}
88+
// CHECK-FIXES: absl::StartsWith(sv, "a");
8989

9090
sv.rfind("a", 0) != 0;
9191
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use !absl::StartsWith
92-
// CHECK-FIXES: {{^[[:space:]]*}}!absl::StartsWith(sv, "a");{{$}}
92+
// CHECK-FIXES: !absl::StartsWith(sv, "a");
9393

9494
// expressions that don't trigger the check are here.
9595
A_MACRO(s.find("a"), 0);

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/bugprone/reserved-identifier-c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ void f__o__o(void);
77
void f_________oo(void);
88
void __foo(void);
99
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '__foo', which is a reserved identifier [bugprone-reserved-identifier]
10-
// CHECK-FIXES: {{^}}void foo(void);{{$}}
10+
// CHECK-FIXES: void foo(void);

0 commit comments

Comments
 (0)