Skip to content

Commit a55bef7

Browse files
Merge branch 'main' into aligned_accessor
2 parents 14c4606 + 949bf51 commit a55bef7

File tree

998 files changed

+246134
-47961
lines changed

Some content is hidden

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

998 files changed

+246134
-47961
lines changed

.ci/metrics/metrics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ def github_get_metrics(
282282
queued_count = collections.Counter()
283283
running_count = collections.Counter()
284284

285+
# Initialize all the counters to 0 so we report 0 when no job is queued
286+
# or running.
287+
for wf_name, wf_metric_name in GITHUB_WORKFLOW_TO_TRACK.items():
288+
for job_name, job_metric_name in GITHUB_JOB_TO_TRACK[wf_metric_name].items():
289+
queued_count[wf_metric_name + "_" + job_metric_name] = 0
290+
running_count[wf_metric_name + "_" + job_metric_name] = 0
291+
285292
# The list of workflows this iteration will process.
286293
# MaxSize = GITHUB_WORKFLOWS_MAX_PROCESS_COUNT
287294
workflow_seen_as_completed = set()

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,12 @@ class MCPlusBuilder {
577577
return getNoRegister();
578578
}
579579

580-
/// Returns the register used as call destination, or no-register, if not
581-
/// an indirect call. Sets IsAuthenticatedInternally if the instruction
582-
/// accepts a signed pointer as its operand and authenticates it internally.
580+
/// Returns the register used as the destination of an indirect branch or call
581+
/// instruction. Sets IsAuthenticatedInternally if the instruction accepts
582+
/// a signed pointer as its operand and authenticates it internally.
583583
virtual MCPhysReg
584-
getRegUsedAsCallDest(const MCInst &Inst,
585-
bool &IsAuthenticatedInternally) const {
584+
getRegUsedAsIndirectBranchDest(const MCInst &Inst,
585+
bool &IsAuthenticatedInternally) const {
586586
llvm_unreachable("not implemented");
587587
return getNoRegister();
588588
}

bolt/lib/Passes/PAuthGadgetScanner.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,16 @@ static std::shared_ptr<Report>
498498
shouldReportCallGadget(const BinaryContext &BC, const MCInstReference &Inst,
499499
const State &S) {
500500
static const GadgetKind CallKind("non-protected call found");
501-
if (!BC.MIB->isCall(Inst) && !BC.MIB->isBranch(Inst))
501+
if (!BC.MIB->isIndirectCall(Inst) && !BC.MIB->isIndirectBranch(Inst))
502502
return nullptr;
503503

504504
bool IsAuthenticated = false;
505-
MCPhysReg DestReg = BC.MIB->getRegUsedAsCallDest(Inst, IsAuthenticated);
506-
if (IsAuthenticated || DestReg == BC.MIB->getNoRegister())
505+
MCPhysReg DestReg =
506+
BC.MIB->getRegUsedAsIndirectBranchDest(Inst, IsAuthenticated);
507+
if (IsAuthenticated)
507508
return nullptr;
508509

510+
assert(DestReg != BC.MIB->getNoRegister());
509511
LLVM_DEBUG({
510512
traceInst(BC, "Found call inst", Inst);
511513
traceReg(BC, "Call destination reg", DestReg);

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#include "AArch64InstrInfo.h"
1314
#include "AArch64MCSymbolizer.h"
1415
#include "MCTargetDesc/AArch64AddressingModes.h"
1516
#include "MCTargetDesc/AArch64FixupKinds.h"
@@ -277,15 +278,14 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
277278
}
278279
}
279280

280-
MCPhysReg
281-
getRegUsedAsCallDest(const MCInst &Inst,
282-
bool &IsAuthenticatedInternally) const override {
283-
assert(isCall(Inst) || isBranch(Inst));
284-
IsAuthenticatedInternally = false;
281+
MCPhysReg getRegUsedAsIndirectBranchDest(
282+
const MCInst &Inst, bool &IsAuthenticatedInternally) const override {
283+
assert(isIndirectCall(Inst) || isIndirectBranch(Inst));
285284

286285
switch (Inst.getOpcode()) {
287286
case AArch64::BR:
288287
case AArch64::BLR:
288+
IsAuthenticatedInternally = false;
289289
return Inst.getOperand(0).getReg();
290290
case AArch64::BRAA:
291291
case AArch64::BRAB:
@@ -298,9 +298,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
298298
IsAuthenticatedInternally = true;
299299
return Inst.getOperand(0).getReg();
300300
default:
301-
if (isIndirectCall(Inst) || isIndirectBranch(Inst))
302-
llvm_unreachable("Unhandled indirect branch");
303-
return getNoRegister();
301+
llvm_unreachable("Unhandled indirect branch or call");
304302
}
305303
}
306304

@@ -699,7 +697,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
699697
}
700698

701699
bool isIndirectCall(const MCInst &Inst) const override {
702-
return Inst.getOpcode() == AArch64::BLR;
700+
return isIndirectCallOpcode(Inst.getOpcode());
703701
}
704702

705703
MCPhysReg getSpRegister(int Size) const {

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "clang/AST/ASTContext.h"
2323
#include "clang/AST/ASTDiagnostic.h"
2424
#include "clang/AST/Attr.h"
25+
#include "clang/AST/Expr.h"
2526
#include "clang/Basic/CharInfo.h"
2627
#include "clang/Basic/Diagnostic.h"
2728
#include "clang/Basic/DiagnosticOptions.h"
@@ -166,8 +167,8 @@ ClangTidyContext::ClangTidyContext(
166167
AllowEnablingAnalyzerAlphaCheckers(AllowEnablingAnalyzerAlphaCheckers),
167168
EnableModuleHeadersParsing(EnableModuleHeadersParsing) {
168169
// Before the first translation unit we can get errors related to command-line
169-
// parsing, use empty string for the file name in this case.
170-
setCurrentFile("");
170+
// parsing, use dummy string for the file name in this case.
171+
setCurrentFile("dummy");
171172
}
172173

173174
ClangTidyContext::~ClangTidyContext() = default;
@@ -528,6 +529,8 @@ void ClangTidyDiagnosticConsumer::forwardDiagnostic(const Diagnostic &Info) {
528529
case clang::DiagnosticsEngine::ak_addrspace:
529530
Builder << static_cast<LangAS>(Info.getRawArg(Index));
530531
break;
532+
case clang::DiagnosticsEngine::ak_expr:
533+
Builder << reinterpret_cast<const Expr *>(Info.getRawArg(Index));
531534
}
532535
}
533536
}

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ Improvements to clang-query
9191
Improvements to clang-tidy
9292
--------------------------
9393

94+
- Changed the :program:`check_clang_tidy.py` tool to use FileCheck's
95+
``--match-full-lines`` instead of ``strict-whitespace`` for ``CHECK-FIXES``
96+
clauses. Added a ``--match-partial-fixes`` option to keep previous behavior on
97+
specific tests. This may break tests for users with custom out-of-tree checks
98+
who use :program:`check_clang_tidy.py` as-is.
99+
94100
- Improved :program:`clang-tidy-diff.py` script. Add the `-warnings-as-errors`
95101
argument to treat warnings as errors.
96102

clang-tools-extra/test/clang-tidy/check_clang_tidy.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def __init__(self, args: argparse.Namespace, extra_args: List[str]) -> None:
105105
self.fixes = MessagePrefix("CHECK-FIXES")
106106
self.messages = MessagePrefix("CHECK-MESSAGES")
107107
self.notes = MessagePrefix("CHECK-NOTES")
108+
self.match_partial_fixes = args.match_partial_fixes
108109

109110
file_name_with_extension = self.assume_file_name or self.input_file_name
110111
_, extension = os.path.splitext(file_name_with_extension)
@@ -248,10 +249,14 @@ def check_fixes(self) -> None:
248249
try_run(
249250
[
250251
"FileCheck",
251-
"-input-file=" + self.temp_file_name,
252+
"--input-file=" + self.temp_file_name,
252253
self.input_file_name,
253-
"-check-prefixes=" + ",".join(self.fixes.prefixes),
254-
"-strict-whitespace",
254+
"--check-prefixes=" + ",".join(self.fixes.prefixes),
255+
(
256+
"--match-full-lines"
257+
if not self.match_partial_fixes
258+
else "--strict-whitespace" # Keeping past behavior.
259+
),
255260
]
256261
)
257262

@@ -372,6 +377,11 @@ def parse_arguments() -> Tuple[argparse.Namespace, List[str]]:
372377
default=["c++11-or-later"],
373378
help="Passed to clang. Special -or-later values are expanded.",
374379
)
380+
parser.add_argument(
381+
"--match-partial-fixes",
382+
action="store_true",
383+
help="allow partial line matches for fixes",
384+
)
375385
return parser.parse_known_args()
376386

377387

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)