Skip to content

Commit d5ccb29

Browse files
committed
rebase
Created using spr 1.3.4
2 parents d153206 + 16300c3 commit d5ccb29

File tree

144 files changed

+6582
-1102
lines changed

Some content is hidden

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

144 files changed

+6582
-1102
lines changed

clang-tools-extra/clangd/ConfigFragment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ struct Fragment {
347347
/// "IWYU": Include what you use. Insert the owning header for top-level
348348
/// symbols, unless the header is already directly included or the
349349
/// symbol is forward-declared
350-
/// "NeverInsert": Never insert headers
350+
/// "Never": Never insert headers
351351
std::optional<Located<std::string>> HeaderInsertion;
352352
};
353353
CompletionBlock Completion;

clang/docs/ReleaseNotes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ Improvements to Clang's diagnostics
371371
372372
- An error is now emitted when a ``musttail`` call is made to a function marked with the ``not_tail_called`` attribute. (#GH133509).
373373

374+
- ``-Whigher-precisision-for-complex-divison`` warns when:
375+
376+
- The divisor is complex.
377+
- When the complex division happens in a higher precision type due to arithmetic promotion.
378+
- When using the divide and assign operator (``/=``).
379+
380+
Fixes #GH131127
381+
374382
Improvements to Clang's time-trace
375383
----------------------------------
376384

@@ -417,6 +425,8 @@ Bug Fixes in This Version
417425
- Fixed a clang 20 regression where diagnostics attached to some calls to member functions
418426
using C++23 "deducing this" did not have a diagnostic location (#GH135522)
419427

428+
- Fixed a crash when a ``friend`` function is redefined as deleted. (#GH135506)
429+
420430
Bug Fixes to Compiler Builtins
421431
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
422432

clang/include/clang/Basic/arm_sme.td

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,33 @@ let SMETargetGuard = "sme-f16f16" in {
907907
}
908908

909909

910+
////////////////////////////////////////////////////////////////////////////////
911+
// SME2 - TMOP, SUTMOP, USTMOP
912+
913+
let SMETargetGuard = "sme2,sme-tmop" in {
914+
def SVTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2d[i", "hbf", MergeNone, "aarch64_sme_ftmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
915+
def SVSTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2d[i", "cs", MergeNone, "aarch64_sme_stmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
916+
def SVUTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2d[i", "UcUs", MergeNone, "aarch64_sme_utmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
917+
def SVSUTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{3}]", "vi2u[i", "c", MergeNone, "aarch64_sme_sutmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
918+
def SVUSTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{3}]", "vi2x[i", "Uc", MergeNone, "aarch64_sme_ustmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
919+
}
920+
921+
let SMETargetGuard = "sme2,sme-tmop,sme-f16f16" in {
922+
def SVTMOPA_F16 : Inst<"svtmopa_lane_za16[_{d}_{d}]", "vi2d[i", "h", MergeNone, "aarch64_sme_ftmopa_za16", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_1>, ImmCheck<4, ImmCheck0_3>]>;
923+
}
924+
925+
let SMETargetGuard = "sme2,sme-tmop,sme-b16b16" in {
926+
def SVTMOPA_BF16 : Inst<"svtmopa_lane_za16[_{d}_{d}]", "vi2d[i", "b", MergeNone, "aarch64_sme_ftmopa_za16", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_1>, ImmCheck<4, ImmCheck0_3>]>;
927+
}
928+
929+
let SMETargetGuard = "sme2,sme-tmop,sme-f8f16" in {
930+
def SVTMOPA_ZA16_FPM : Inst<"svtmopa_lane_za16[_{d}_{d}]", "vi2.dd[i>", "m", MergeNone, "aarch64_sme_ftmopa_za16", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_1>, ImmCheck<4, ImmCheck0_3>]>;
931+
}
932+
933+
let SMETargetGuard = "sme2,sme-tmop,sme-f8f32" in {
934+
def SVTMOPA_ZA32_FPM : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2.dd[i>", "m", MergeNone, "aarch64_sme_ftmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
935+
}
936+
910937
multiclass ZAReadz<string n_suffix, string vg_num, string t, string i_prefix, list<ImmCheck> ch> {
911938
let SMETargetGuard = "sme2p1" in {
912939
def NAME # _H : SInst<"svreadz_hor_" # n_suffix # "_{d}_vg" # vg_num, vg_num # "im", t,

clang/include/clang/Basic/arm_sve.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,11 @@ defm SVRINTP : SInstZPZ<"svrintp", "hfd", "aarch64_sve_frintp">;
836836
defm SVRINTX : SInstZPZ<"svrintx", "hfd", "aarch64_sve_frintx">;
837837
defm SVRINTZ : SInstZPZ<"svrintz", "hfd", "aarch64_sve_frintz">;
838838
defm SVSQRT : SInstZPZ<"svsqrt", "hfd", "aarch64_sve_fsqrt">;
839-
839+
def SVEXPA : SInst<"svexpa[_{d}]", "du", "hfd", MergeNone, "aarch64_sve_fexpa_x", [VerifyRuntimeMode]>{
840+
let SVETargetGuard = "sve";
841+
let SMETargetGuard = "sme2,ssve-fexpa";
842+
}
840843
let SVETargetGuard = "sve", SMETargetGuard = InvalidMode in {
841-
def SVEXPA : SInst<"svexpa[_{d}]", "du", "hfd", MergeNone, "aarch64_sve_fexpa_x">;
842844
def SVTMAD : SInst<"svtmad[_{d}]", "dddi", "hfd", MergeNone, "aarch64_sve_ftmad_x", [], [ImmCheck<2, ImmCheck0_7>]>;
843845
def SVTSMUL : SInst<"svtsmul[_{d}]", "ddu", "hfd", MergeNone, "aarch64_sve_ftsmul_x">;
844846
def SVTSSEL : SInst<"svtssel[_{d}]", "ddu", "hfd", MergeNone, "aarch64_sve_ftssel_x">;

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,7 +4057,7 @@ template <class Emitter> bool Compiler<Emitter>::visitBool(const Expr *E) {
40574057
return true;
40584058

40594059
// Convert pointers to bool.
4060-
if (T == PT_Ptr || T == PT_FnPtr) {
4060+
if (T == PT_Ptr) {
40614061
if (!this->emitNull(*T, 0, nullptr, E))
40624062
return false;
40634063
return this->emitNE(*T, E);
@@ -4103,8 +4103,6 @@ bool Compiler<Emitter>::visitZeroInitializer(PrimType T, QualType QT,
41034103
case PT_Ptr:
41044104
return this->emitNullPtr(Ctx.getASTContext().getTargetNullPointerValue(QT),
41054105
nullptr, E);
4106-
case PT_FnPtr:
4107-
return this->emitNullFnPtr(0, nullptr, E);
41084106
case PT_MemberPtr:
41094107
return this->emitNullMemberPtr(0, nullptr, E);
41104108
case PT_Float:
@@ -4255,7 +4253,6 @@ bool Compiler<Emitter>::emitConst(T Value, PrimType Ty, const Expr *E) {
42554253
case PT_Bool:
42564254
return this->emitConstBool(Value, E);
42574255
case PT_Ptr:
4258-
case PT_FnPtr:
42594256
case PT_MemberPtr:
42604257
case PT_Float:
42614258
case PT_IntAP:
@@ -4293,7 +4290,8 @@ bool Compiler<Emitter>::emitConst(const APSInt &Value, const Expr *E) {
42934290

42944291
template <class Emitter>
42954292
unsigned Compiler<Emitter>::allocateLocalPrimitive(
4296-
DeclTy &&Src, PrimType Ty, bool IsConst, const ValueDecl *ExtendingDecl) {
4293+
DeclTy &&Src, PrimType Ty, bool IsConst, const ValueDecl *ExtendingDecl,
4294+
bool IsConstexprUnknown) {
42974295
// Make sure we don't accidentally register the same decl twice.
42984296
if (const auto *VD =
42994297
dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>())) {
@@ -4307,6 +4305,7 @@ unsigned Compiler<Emitter>::allocateLocalPrimitive(
43074305
// or isa<MaterializeTemporaryExpr>().
43084306
Descriptor *D = P.createDescriptor(Src, Ty, nullptr, Descriptor::InlineDescMD,
43094307
IsConst, isa<const Expr *>(Src));
4308+
D->IsConstexprUnknown = IsConstexprUnknown;
43104309
Scope::Local Local = this->createLocal(D);
43114310
if (auto *VD = dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>()))
43124311
Locals.insert({VD, Local});
@@ -4320,7 +4319,8 @@ unsigned Compiler<Emitter>::allocateLocalPrimitive(
43204319
template <class Emitter>
43214320
std::optional<unsigned>
43224321
Compiler<Emitter>::allocateLocal(DeclTy &&Src, QualType Ty,
4323-
const ValueDecl *ExtendingDecl) {
4322+
const ValueDecl *ExtendingDecl,
4323+
bool IsConstexprUnknown) {
43244324
// Make sure we don't accidentally register the same decl twice.
43254325
if ([[maybe_unused]] const auto *VD =
43264326
dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>())) {
@@ -4349,6 +4349,7 @@ Compiler<Emitter>::allocateLocal(DeclTy &&Src, QualType Ty,
43494349
IsTemporary, /*IsMutable=*/false, Init);
43504350
if (!D)
43514351
return std::nullopt;
4352+
D->IsConstexprUnknown = IsConstexprUnknown;
43524353

43534354
Scope::Local Local = this->createLocal(D);
43544355
if (Key)
@@ -4460,9 +4461,10 @@ bool Compiler<Emitter>::visitExpr(const Expr *E, bool DestroyToplevelScope) {
44604461
}
44614462

44624463
template <class Emitter>
4463-
VarCreationState Compiler<Emitter>::visitDecl(const VarDecl *VD) {
4464+
VarCreationState Compiler<Emitter>::visitDecl(const VarDecl *VD,
4465+
bool IsConstexprUnknown) {
44644466

4465-
auto R = this->visitVarDecl(VD, /*Toplevel=*/true);
4467+
auto R = this->visitVarDecl(VD, /*Toplevel=*/true, IsConstexprUnknown);
44664468

44674469
if (R.notCreated())
44684470
return R;
@@ -4550,7 +4552,8 @@ bool Compiler<Emitter>::visitDeclAndReturn(const VarDecl *VD,
45504552

45514553
template <class Emitter>
45524554
VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
4553-
bool Toplevel) {
4555+
bool Toplevel,
4556+
bool IsConstexprUnknown) {
45544557
// We don't know what to do with these, so just return false.
45554558
if (VD->getType().isNull())
45564559
return false;
@@ -4620,7 +4623,8 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
46204623

46214624
if (VarT) {
46224625
unsigned Offset = this->allocateLocalPrimitive(
4623-
VD, *VarT, VD->getType().isConstQualified());
4626+
VD, *VarT, VD->getType().isConstQualified(), nullptr,
4627+
IsConstexprUnknown);
46244628
if (Init) {
46254629
// If this is a toplevel declaration, create a scope for the
46264630
// initializer.
@@ -4636,7 +4640,8 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
46364640
}
46374641
}
46384642
} else {
4639-
if (std::optional<unsigned> Offset = this->allocateLocal(VD)) {
4643+
if (std::optional<unsigned> Offset = this->allocateLocal(
4644+
VD, VD->getType(), nullptr, IsConstexprUnknown)) {
46404645
if (!Init)
46414646
return true;
46424647

@@ -4948,7 +4953,7 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
49484953
// If we know the callee already, check the known parametrs for nullability.
49494954
if (FuncDecl && NonNullArgs[ArgIndex]) {
49504955
PrimType ArgT = classify(Arg).value_or(PT_Ptr);
4951-
if (ArgT == PT_Ptr || ArgT == PT_FnPtr) {
4956+
if (ArgT == PT_Ptr) {
49524957
if (!this->emitCheckNonNullArg(ArgT, Arg))
49534958
return false;
49544959
}
@@ -5989,7 +5994,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
59895994
if (!this->visit(SubExpr))
59905995
return false;
59915996

5992-
if (T == PT_Ptr || T == PT_FnPtr) {
5997+
if (T == PT_Ptr) {
59935998
if (!this->emitIncPtr(E))
59945999
return false;
59956000

@@ -6013,7 +6018,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60136018
if (!this->visit(SubExpr))
60146019
return false;
60156020

6016-
if (T == PT_Ptr || T == PT_FnPtr) {
6021+
if (T == PT_Ptr) {
60176022
if (!this->emitDecPtr(E))
60186023
return false;
60196024

@@ -6037,7 +6042,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60376042
if (!this->visit(SubExpr))
60386043
return false;
60396044

6040-
if (T == PT_Ptr || T == PT_FnPtr) {
6045+
if (T == PT_Ptr) {
60416046
if (!this->emitLoadPtr(E))
60426047
return false;
60436048
if (!this->emitConstUint8(1, E))
@@ -6080,7 +6085,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60806085
if (!this->visit(SubExpr))
60816086
return false;
60826087

6083-
if (T == PT_Ptr || T == PT_FnPtr) {
6088+
if (T == PT_Ptr) {
60846089
if (!this->emitLoadPtr(E))
60856090
return false;
60866091
if (!this->emitConstUint8(1, E))
@@ -6461,7 +6466,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
64616466

64626467
// In case we need to re-visit a declaration.
64636468
auto revisit = [&](const VarDecl *VD) -> bool {
6464-
auto VarState = this->visitDecl(VD);
6469+
auto VarState = this->visitDecl(VD, /*IsConstexprUnknown=*/true);
64656470

64666471
if (VarState.notCreated())
64676472
return true;

clang/lib/AST/ByteCode/Compiler.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,10 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
286286
/// intact.
287287
bool delegate(const Expr *E);
288288
/// Creates and initializes a variable from the given decl.
289-
VarCreationState visitVarDecl(const VarDecl *VD, bool Toplevel = false);
290-
VarCreationState visitDecl(const VarDecl *VD);
289+
VarCreationState visitVarDecl(const VarDecl *VD, bool Toplevel = false,
290+
bool IsConstexprUnknown = false);
291+
VarCreationState visitDecl(const VarDecl *VD,
292+
bool IsConstexprUnknown = false);
291293
/// Visit an APValue.
292294
bool visitAPValue(const APValue &Val, PrimType ValType, const Expr *E);
293295
bool visitAPValueInitializer(const APValue &Val, const Expr *E, QualType T);
@@ -303,12 +305,14 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
303305

304306
/// Creates a local primitive value.
305307
unsigned allocateLocalPrimitive(DeclTy &&Decl, PrimType Ty, bool IsConst,
306-
const ValueDecl *ExtendingDecl = nullptr);
308+
const ValueDecl *ExtendingDecl = nullptr,
309+
bool IsConstexprUnknown = false);
307310

308311
/// Allocates a space storing a local given its type.
309312
std::optional<unsigned>
310313
allocateLocal(DeclTy &&Decl, QualType Ty = QualType(),
311-
const ValueDecl *ExtendingDecl = nullptr);
314+
const ValueDecl *ExtendingDecl = nullptr,
315+
bool IsConstexprUnknown = false);
312316
std::optional<unsigned> allocateTemporary(const Expr *E);
313317

314318
private:

clang/lib/AST/ByteCode/Descriptor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct Descriptor final {
168168
const bool IsArray = false;
169169
/// Flag indicating if this is a dummy descriptor.
170170
bool IsDummy = false;
171+
bool IsConstexprUnknown = false;
171172

172173
/// Storage management methods.
173174
const BlockCtorFn CtorFn = nullptr;

clang/lib/AST/ByteCode/Disasm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ static const char *primTypeToString(PrimType T) {
256256
return "Float";
257257
case PT_Ptr:
258258
return "Ptr";
259-
case PT_FnPtr:
260-
return "FnPtr";
261259
case PT_MemberPtr:
262260
return "MemberPtr";
263261
case PT_FixedPoint:
@@ -376,6 +374,8 @@ LLVM_DUMP_METHOD void Descriptor::dump(llvm::raw_ostream &OS) const {
376374

377375
if (isDummy())
378376
OS << " dummy";
377+
if (IsConstexprUnknown)
378+
OS << " constexpr-unknown";
379379
}
380380

381381
/// Dump descriptor, including all valid offsets.

clang/lib/AST/ByteCode/EvalEmitter.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ bool EvalEmitter::speculate(const CallExpr *E, const LabelTy &EndLabel) {
142142
if (T == PT_Ptr) {
143143
const auto &Ptr = S.Stk.pop<Pointer>();
144144
return this->emitBool(CheckBCPResult(S, Ptr), E);
145-
} else if (T == PT_FnPtr) {
146-
S.Stk.discard<FunctionPointer>();
147-
// Never accepted
148-
return this->emitBool(false, E);
149145
}
150146

151147
// Otherwise, this is fine!
@@ -210,14 +206,6 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
210206

211207
return true;
212208
}
213-
template <> bool EvalEmitter::emitRet<PT_FnPtr>(const SourceInfo &Info) {
214-
if (!isActive())
215-
return true;
216-
217-
// Function pointers cannot be converted to rvalues.
218-
EvalResult.setFunctionPointer(S.Stk.pop<FunctionPointer>());
219-
return true;
220-
}
221209

222210
bool EvalEmitter::emitRetVoid(const SourceInfo &Info) {
223211
EvalResult.setValid();

clang/lib/AST/ByteCode/FunctionPointer.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,22 @@ APValue FunctionPointer::toAPValue(const ASTContext &) const {
1616
return APValue(static_cast<Expr *>(nullptr), CharUnits::Zero(), {},
1717
/*OnePastTheEnd=*/false, /*IsNull=*/true);
1818

19-
if (!Valid)
20-
return APValue(static_cast<Expr *>(nullptr),
21-
CharUnits::fromQuantity(getIntegerRepresentation()), {},
22-
/*OnePastTheEnd=*/false, /*IsNull=*/false);
23-
2419
if (Func->getDecl())
25-
return APValue(Func->getDecl(), CharUnits::fromQuantity(Offset), {},
20+
return APValue(Func->getDecl(), CharUnits::fromQuantity(0), {},
2621
/*OnePastTheEnd=*/false, /*IsNull=*/false);
27-
return APValue(Func->getExpr(), CharUnits::fromQuantity(Offset), {},
22+
return APValue(Func->getExpr(), CharUnits::fromQuantity(0), {},
2823
/*OnePastTheEnd=*/false, /*IsNull=*/false);
2924
}
3025

3126
void FunctionPointer::print(llvm::raw_ostream &OS) const {
3227
OS << "FnPtr(";
33-
if (Func && Valid)
28+
if (Func)
3429
OS << Func->getName();
3530
else if (Func)
3631
OS << reinterpret_cast<uintptr_t>(Func);
3732
else
3833
OS << "nullptr";
39-
OS << ") + " << Offset;
34+
OS << ")";
4035
}
4136

4237
} // namespace interp

0 commit comments

Comments
 (0)