Skip to content

Commit e2351fe

Browse files
committed
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_with
2 parents 9d6f09b + 8818728 commit e2351fe

File tree

425 files changed

+21155
-3337
lines changed

Some content is hidden

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

425 files changed

+21155
-3337
lines changed

.ci/generate_test_report_lib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def plural(num_tests):
9292
]
9393
)
9494
elif failures:
95-
report.extend(["", "## Failed Tests", "(click on a test name to see its output)"])
95+
report.extend(
96+
["", "## Failed Tests", "(click on a test name to see its output)"]
97+
)
9698

9799
for testsuite_name, failures in failures.items():
98100
report.extend(["", f"### {testsuite_name}"])

.ci/metrics/metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
# remain small.
6868
BUILDKITE_GRAPHQL_BUILDS_PER_PAGE = 50
6969

70+
7071
@dataclass
7172
class JobMetrics:
7273
job_name: str
@@ -77,6 +78,7 @@ class JobMetrics:
7778
workflow_id: int
7879
workflow_name: str
7980

81+
8082
@dataclass
8183
class GaugeMetric:
8284
name: str
@@ -258,6 +260,7 @@ def buildkite_get_metrics(
258260

259261
return output, incomplete_now
260262

263+
261264
def github_get_metrics(
262265
github_repo: github.Repository, last_workflows_seen_as_completed: set[int]
263266
) -> tuple[list[JobMetrics], int]:

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,10 +1783,22 @@ bool BinaryFunction::scanExternalRefs() {
17831783
// On AArch64, we use instruction patches for fixing references. We make an
17841784
// exception for branch instructions since they require optional
17851785
// relocations.
1786-
if (BC.isAArch64() && !BranchTargetSymbol) {
1787-
LLVM_DEBUG(BC.printInstruction(dbgs(), Instruction, AbsoluteInstrAddr));
1788-
InstructionPatches.push_back({AbsoluteInstrAddr, Instruction});
1789-
continue;
1786+
if (BC.isAArch64()) {
1787+
if (!BranchTargetSymbol) {
1788+
LLVM_DEBUG(BC.printInstruction(dbgs(), Instruction, AbsoluteInstrAddr));
1789+
InstructionPatches.push_back({AbsoluteInstrAddr, Instruction});
1790+
continue;
1791+
}
1792+
1793+
// Conditional tail calls require new relocation types that are currently
1794+
// not supported. https://github.com/llvm/llvm-project/issues/138264
1795+
if (BC.MIB->isConditionalBranch(Instruction)) {
1796+
if (BinaryFunction *TargetBF =
1797+
BC.getFunctionForSymbol(BranchTargetSymbol)) {
1798+
TargetBF->setNeedsPatch(true);
1799+
continue;
1800+
}
1801+
}
17901802
}
17911803

17921804
// Emit the instruction using temp emitter and generate relocations.

bolt/lib/Passes/PAuthGadgetScanner.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ class DataflowSrcSafetyAnalysis
571571
traceInst(BC, "First instruction", FirstInst);
572572
traceInst(BC, "Last instruction", LastInst);
573573
});
574+
(void)CheckedReg;
575+
(void)FirstInst;
574576
assert(llvm::any_of(BB, [&](MCInst &I) { return &I == &FirstInst; }) &&
575577
"Data-flow analysis expects the checker not to cross BBs");
576578
CheckerSequenceInfo[&LastInst] = *CheckerInfo;

bolt/test/AArch64/check-init-not-moved.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# address. Test checks that _init is not moved.
66

77
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
8-
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--section-start=.data=0x1000 -Wl,--section-start=.init=0x1004
8+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--image-base=0,-Tdata=0x1000,--section-start=.init=0x1004
99
# RUN: llvm-bolt %t.exe -o %t.bolt
1010
# RUN: llvm-nm %t.exe | FileCheck --check-prefix=CHECK-ORIGINAL %s
1111
# RUN: llvm-nm %t.bolt | FileCheck --check-prefix=CHECK-BOLTED %s

bolt/test/AArch64/lite-mode.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ cold_function:
129129
# CHECK-INPUT-NEXT: b {{.*}} <_start>
130130
# CHECK-NEXT: b {{.*}} <_start.org.0>
131131

132+
## Quick test for conditional tail calls. A proper test is being added in:
133+
## https://github.com/llvm/llvm-project/pull/139565
134+
## For now check that llvm-bolt doesn't choke on CTCs.
135+
.ifndef COMPACT
136+
b.eq _start
137+
cbz x0, _start
138+
tbz x0, 42, _start
139+
.endif
140+
132141
.cfi_endproc
133142
.size cold_function, .-cold_function
134143

bolt/test/AArch64/pad-before-funcs.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
11-
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -Wl,--section-start=.text=0x4000
11+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -Wl,--image-base=0x3000,--section-start=.text=0x4000
1212
# RUN: llvm-bolt %t.exe -o %t.bolt.0 --pad-funcs-before=_start:0
1313
# RUN: llvm-bolt %t.exe -o %t.bolt.4 --pad-funcs-before=_start:4
1414
# RUN: llvm-bolt %t.exe -o %t.bolt.8 --pad-funcs-before=_start:8

bolt/test/RISCV/reloc-jt.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// NOTE: assign section addresses explicitly to make the symbol difference
22
/// calculation below less fragile.
3-
// RUN: %clang %cflags -Wl,--section-start=.text=0x1000,--section-start=.data=0x2000 -o %t %s
3+
// RUN: %clang %cflags -Wl,--image-base=0,--section-start=.text=0x1000,--section-start=.data=0x2000 -o %t %s
44
// RUN: llvm-bolt -o %t.bolt %t
55
// RUN: llvm-readelf -x .data %t.bolt | FileCheck %s
66

bolt/test/X86/double-rel-scan.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# REQUIRES: system-linux
77

88
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
9-
# RUN: ld.lld %t.o -o %t.exe -q --Ttext=0x80000
9+
# RUN: ld.lld %t.o -o %t.exe -q --image-base=0x80000 --Ttext=0x80000
1010
# RUN: llvm-bolt %t.exe --relocs -o %t.bolt --funcs=foo
1111
# RUN: llvm-objdump -d --print-imm-hex %t.exe \
1212
# RUN: | FileCheck %s

bolt/test/X86/double-rel.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# REQUIRES: system-linux
66

77
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
8-
# RUN: ld.lld %t.o -o %t.exe -q --Tdata=0x80000
8+
# RUN: ld.lld %t.o -o %t.exe -q --image-base=0x70000 --Tdata=0x80000
99
# RUN: llvm-bolt %t.exe --relocs -o %t.null --print-only=_start --print-disasm \
1010
# RUN: | FileCheck %s --check-prefix=CHECK-BOLT
1111
# RUN: llvm-objdump -d --print-imm-hex %t.exe \

clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ static bool hasRValueOverload(const CXXConstructorDecl *Ctor,
166166
};
167167

168168
for (const auto *Candidate : Record->ctors()) {
169-
if (IsRValueOverload(Candidate)) {
169+
if (IsRValueOverload(Candidate))
170170
return true;
171-
}
172171
}
173172
return false;
174173
}

clang-tools-extra/clang-tidy/modernize/PassByValueCheck.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include "../ClangTidyCheck.h"
1313
#include "../utils/IncludeInserter.h"
1414

15-
#include <memory>
16-
1715
namespace clang::tidy::modernize {
1816

1917
class PassByValueCheck : public ClangTidyCheck {

clang-tools-extra/clang-tidy/readability/EnumInitialValueCheck.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ static void cleanInitialValue(DiagnosticBuilder &Diag,
7070
return;
7171
Diag << FixItHint::CreateRemoval(EqualLoc)
7272
<< FixItHint::CreateRemoval(InitExprRange);
73-
return;
7473
}
7574

7675
namespace {

clang-tools-extra/clangd/unittests/ProjectAwareIndexTests.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ TEST(ProjectAware, Test) {
4949
C.Index.External.Location = "test";
5050
WithContextValue With(Config::Key, std::move(C));
5151
EXPECT_THAT(match(*Idx, Req), ElementsAre("1"));
52-
return;
5352
}
5453

5554
TEST(ProjectAware, CreatedOnce) {
@@ -80,7 +79,6 @@ TEST(ProjectAware, CreatedOnce) {
8079
match(*Idx, Req);
8180
// It is cached afterwards.
8281
EXPECT_EQ(InvocationCount, 1U);
83-
return;
8482
}
8583
} // namespace clangd
8684
} // namespace clang

clang-tools-extra/test/clang-tidy/checkers/modernize/pass-by-value.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,16 @@ struct A {
3232
Movable GlobalObj;
3333
struct B {
3434
B(const Movable &M) : M(GlobalObj) {}
35-
// CHECK-FIXES: B(const Movable &M) : M(GlobalObj) {}
3635
Movable M;
3736
};
3837

3938
// Test that a parameter with more than one reference to it won't be changed.
4039
struct C {
4140
// Tests extra-reference in body.
4241
C(const Movable &M) : M(M) { this->i = M.a; }
43-
// CHECK-FIXES: C(const Movable &M) : M(M) { this->i = M.a; }
4442

4543
// Tests extra-reference in init-list.
4644
C(const Movable &M, int) : M(M), i(M.a) {}
47-
// CHECK-FIXES: C(const Movable &M, int) : M(M), i(M.a) {}
4845
Movable M;
4946
int i;
5047
};
@@ -70,7 +67,6 @@ struct E {
7067
// Test with object that can't be moved.
7168
struct F {
7269
F(const NotMovable &NM) : NM(NM) {}
73-
// CHECK-FIXES: F(const NotMovable &NM) : NM(NM) {}
7470
NotMovable NM;
7571
};
7672

@@ -112,7 +108,6 @@ struct I {
112108
// Test that templates aren't modified.
113109
template <typename T> struct J {
114110
J(const T &M) : M(M) {}
115-
// CHECK-FIXES: J(const T &M) : M(M) {}
116111
T M;
117112
};
118113
J<Movable> j1(Movable());
@@ -129,13 +124,11 @@ struct MovableTemplateT
129124
template <class T>
130125
struct J2 {
131126
J2(const MovableTemplateT<T>& A);
132-
// CHECK-FIXES: J2(const MovableTemplateT<T>& A);
133127
MovableTemplateT<T> M;
134128
};
135129

136130
template <class T>
137131
J2<T>::J2(const MovableTemplateT<T>& A) : M(A) {}
138-
// CHECK-FIXES: J2<T>::J2(const MovableTemplateT<T>& A) : M(A) {}
139132
J2<int> j3(MovableTemplateT<int>{});
140133

141134
struct K_Movable {
@@ -182,7 +175,6 @@ struct O {
182175
// Test with a const-value parameter.
183176
struct P {
184177
P(const Movable M) : M(M) {}
185-
// CHECK-FIXES: P(const Movable M) : M(M) {}
186178
Movable M;
187179
};
188180

@@ -215,7 +207,6 @@ struct R {
215207
// Test with rvalue parameter.
216208
struct S {
217209
S(Movable &&M) : M(M) {}
218-
// CHECK-FIXES: S(Movable &&M) : M(M) {}
219210
Movable M;
220211
};
221212

@@ -225,13 +216,11 @@ template <typename T, int N> struct array { T A[N]; };
225216
// cause problems with performance-move-const-arg, as it will revert it.
226217
struct T {
227218
T(array<int, 10> a) : a_(a) {}
228-
// CHECK-FIXES: T(array<int, 10> a) : a_(a) {}
229219
array<int, 10> a_;
230220
};
231221

232222
struct U {
233223
U(const POD &M) : M(M) {}
234-
// CHECK-FIXES: U(const POD &M) : M(M) {}
235224
POD M;
236225
};
237226

clang/docs/ReleaseNotes.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,13 +683,27 @@ Bug Fixes to C++ Support
683683
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
684684
- Clang now prints the correct instantiation context for diagnostics suppressed
685685
by template argument deduction.
686+
- Errors that occur during evaluation of certain type traits and builtins are
687+
no longer incorrectly emitted when they are used in an SFINAE context. The
688+
type traits are:
689+
690+
- ``__is_constructible`` and variants,
691+
- ``__is_convertible`` and variants,
692+
- ``__is_assignable`` and variants,
693+
- ``__reference_binds_to_temporary``,
694+
``__reference_constructs_from_temporary``,
695+
``__reference_converts_from_temporary``,
696+
- ``__is_trivially_equality_comparable``.
697+
698+
The builtin is ``__builtin_common_type``. (#GH132044)
686699
- Clang is now better at instantiating the function definition after its use inside
687700
of a constexpr lambda. (#GH125747)
688701
- Fixed a local class member function instantiation bug inside dependent lambdas. (#GH59734), (#GH132208)
689702
- Clang no longer crashes when trying to unify the types of arrays with
690703
certain differences in qualifiers (this could happen during template argument
691704
deduction or when building a ternary operator). (#GH97005)
692705
- Fixed type alias CTAD issues involving default template arguments. (#GH134471)
706+
- Fixed CTAD issues when initializing anonymous fields with designated initializers. (#GH67173)
693707
- The initialization kind of elements of structured bindings
694708
direct-list-initialized from an array is corrected to direct-initialization.
695709
- Clang no longer crashes when a coroutine is declared ``[[noreturn]]``. (#GH127327)

clang/include/clang/AST/Type.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8583,8 +8583,7 @@ bool IsEnumDeclScoped(EnumDecl *);
85838583

85848584
inline bool Type::isIntegerType() const {
85858585
if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8586-
return BT->getKind() >= BuiltinType::Bool &&
8587-
BT->getKind() <= BuiltinType::Int128;
8586+
return BT->isInteger();
85888587
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
85898588
// Incomplete enum types are not treated as integer types.
85908589
// FIXME: In C++, enum types are never integer types.
@@ -8658,8 +8657,7 @@ inline bool Type::isScalarType() const {
86588657

86598658
inline bool Type::isIntegralOrEnumerationType() const {
86608659
if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8661-
return BT->getKind() >= BuiltinType::Bool &&
8662-
BT->getKind() <= BuiltinType::Int128;
8660+
return BT->isInteger();
86638661

86648662
// Check for a complete enum type; incomplete enum types are not properly an
86658663
// enumeration type in the sense required here.

clang/include/clang/Analysis/ProgramPoint.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,14 @@ class ProgramPoint {
224224

225225
class BlockEntrance : public ProgramPoint {
226226
public:
227-
BlockEntrance(const CFGBlock *B, const LocationContext *L,
228-
const ProgramPointTag *tag = nullptr)
229-
: ProgramPoint(B, BlockEntranceKind, L, tag) {
230-
assert(B && "BlockEntrance requires non-null block");
227+
BlockEntrance(const CFGBlock *PrevBlock, const CFGBlock *CurrBlock,
228+
const LocationContext *L, const ProgramPointTag *Tag = nullptr)
229+
: ProgramPoint(CurrBlock, PrevBlock, BlockEntranceKind, L, Tag) {
230+
assert(CurrBlock && "BlockEntrance requires non-null block");
231+
}
232+
233+
const CFGBlock *getPreviousBlock() const {
234+
return reinterpret_cast<const CFGBlock *>(getData2());
231235
}
232236

233237
const CFGBlock *getBlock() const {
@@ -760,13 +764,15 @@ template <> struct DenseMapInfo<clang::ProgramPoint> {
760764
static inline clang::ProgramPoint getEmptyKey() {
761765
uintptr_t x =
762766
reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getEmptyKey()) & ~0x7;
763-
return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), nullptr);
767+
return clang::BlockEntrance(nullptr, reinterpret_cast<clang::CFGBlock *>(x),
768+
nullptr);
764769
}
765770

766771
static inline clang::ProgramPoint getTombstoneKey() {
767772
uintptr_t x =
768773
reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getTombstoneKey()) & ~0x7;
769-
return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), nullptr);
774+
return clang::BlockEntrance(nullptr, reinterpret_cast<clang::CFGBlock *>(x),
775+
nullptr);
770776
}
771777

772778
static unsigned getHashValue(const clang::ProgramPoint &Loc) {

clang/include/clang/Sema/Sema.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12365,16 +12365,19 @@ class Sema final : public SemaBase {
1236512365
bool PrevLastDiagnosticIgnored;
1236612366

1236712367
public:
12368-
explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
12368+
/// \param ForValidityCheck If true, discard all diagnostics (from the
12369+
/// immediate context) instead of adding them to the currently active
12370+
/// \ref TemplateDeductionInfo (as returned by \ref isSFINAEContext).
12371+
explicit SFINAETrap(Sema &SemaRef, bool ForValidityCheck = false)
1236912372
: SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
1237012373
PrevInNonInstantiationSFINAEContext(
1237112374
SemaRef.InNonInstantiationSFINAEContext),
1237212375
PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE),
1237312376
PrevLastDiagnosticIgnored(
1237412377
SemaRef.getDiagnostics().isLastDiagnosticIgnored()) {
12375-
if (!SemaRef.isSFINAEContext())
12378+
if (ForValidityCheck || !SemaRef.isSFINAEContext())
1237612379
SemaRef.InNonInstantiationSFINAEContext = true;
12377-
SemaRef.AccessCheckingSFINAE = AccessCheckingSFINAE;
12380+
SemaRef.AccessCheckingSFINAE = ForValidityCheck;
1237812381
}
1237912382

1238012383
~SFINAETrap() {
@@ -12404,7 +12407,7 @@ class Sema final : public SemaBase {
1240412407

1240512408
public:
1240612409
explicit TentativeAnalysisScope(Sema &SemaRef)
12407-
: SemaRef(SemaRef), Trap(SemaRef, true),
12410+
: SemaRef(SemaRef), Trap(SemaRef, /*ForValidityCheck=*/true),
1240812411
PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
1240912412
SemaRef.DisableTypoCorrection = true;
1241012413
}

0 commit comments

Comments
 (0)