Skip to content

Commit 6c41ed2

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into zcfs
2 parents e35ac62 + 419fa1b commit 6c41ed2

File tree

237 files changed

+11534
-2445
lines changed

Some content is hidden

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

237 files changed

+11534
-2445
lines changed

bolt/runtime/hugify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===---------------------------------------------------------------------===//
88

9-
#if defined(__x86_64__) || \
10-
(defined(__aarch64__) || defined(__arm64__)) && !defined(__APPLE__)
9+
#if (defined(__x86_64__) || defined(__aarch64__) || defined(__arm64__)) && \
10+
!defined(__APPLE__)
1111

1212
#include "common.h"
1313

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/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ set(LLVM_TOOLCHAIN_TOOLS
459459
llvm-libtool-darwin
460460
llvm-lipo
461461
llvm-ml
462-
llvm-mt
463462
llvm-nm
464463
llvm-objcopy
465464
llvm-objdump
@@ -481,6 +480,10 @@ set(LLVM_TOOLCHAIN_TOOLS
481480
scan-build-py
482481
CACHE STRING "")
483482

483+
if (LLVM_ENABLE_LIBXML2)
484+
list(APPEND LLVM_TOOLCHAIN_TOOLS llvm-mt)
485+
endif()
486+
484487
set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS
485488
bolt
486489
clang

clang/docs/ReleaseNotes.rst

Lines changed: 12 additions & 2 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

@@ -402,6 +410,7 @@ Bug Fixes in This Version
402410
when using the ``INTn_C`` macros. (#GH85995)
403411
- Fixed an assertion failure in the expansion of builtin macros like ``__has_embed()`` with line breaks before the
404412
closing paren. (#GH133574)
413+
- Fixed a crash in error recovery for expressions resolving to templates. (#GH135621)
405414
- Clang no longer accepts invalid integer constants which are too large to fit
406415
into any (standard or extended) integer type when the constant is unevaluated.
407416
Merely forming the token is sufficient to render the program invalid. Code
@@ -416,6 +425,8 @@ Bug Fixes in This Version
416425
- Fixed a clang 20 regression where diagnostics attached to some calls to member functions
417426
using C++23 "deducing this" did not have a diagnostic location (#GH135522)
418427

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

@@ -457,7 +468,6 @@ Bug Fixes to C++ Support
457468
by template argument deduction.
458469
- Clang is now better at instantiating the function definition after its use inside
459470
of a constexpr lambda. (#GH125747)
460-
- Fixed a local class member function instantiation bug inside dependent lambdas. (#GH59734), (#GH132208)
461471
- Clang no longer crashes when trying to unify the types of arrays with
462472
certain differences in qualifiers (this could happen during template argument
463473
deduction or when building a ternary operator). (#GH97005)
@@ -549,7 +559,7 @@ Arm and AArch64 Support
549559
^^^^^^^^^^^^^^^^^^^^^^^
550560
- For ARM targets, cc1as now considers the FPU's features for the selected CPU or Architecture.
551561
- The ``+nosimd`` attribute is now fully supported for ARM. Previously, this had no effect when being used with
552-
ARM targets, however this will now disable NEON instructions being generated. The ``simd`` option is
562+
ARM targets, however this will now disable NEON instructions being generated. The ``simd`` option is
553563
also now printed when the ``--print-supported-extensions`` option is used.
554564

555565
- Support for __ptrauth type qualifier has been added.

clang/include/clang/AST/OpenACCClause.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ class OpenACCSelfClause final
430430
}
431431

432432
bool isConditionExprClause() const { return HasConditionExpr.has_value(); }
433+
bool isVarListClause() const { return !isConditionExprClause(); }
434+
bool isEmptySelfClause() const {
435+
return (isConditionExprClause() && !hasConditionExpr()) ||
436+
(!isConditionExprClause() && getVarList().empty());
437+
}
433438

434439
bool hasConditionExpr() const {
435440
assert(HasConditionExpr.has_value() &&

clang/include/clang/Basic/BuiltinsNVPTX.td

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,15 @@ def __nvvm_f2bf16_rz : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
580580
def __nvvm_f2bf16_rz_relu : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
581581

582582
def __nvvm_f2tf32_rna : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_80, PTX70>;
583+
def __nvvm_f2tf32_rna_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_89, PTX81>;
584+
def __nvvm_f2tf32_rn : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
585+
def __nvvm_f2tf32_rn_relu : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
586+
def __nvvm_f2tf32_rn_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
587+
def __nvvm_f2tf32_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
588+
def __nvvm_f2tf32_rz : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
589+
def __nvvm_f2tf32_rz_relu : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
590+
def __nvvm_f2tf32_rz_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
591+
def __nvvm_f2tf32_rz_relu_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
583592

584593
def __nvvm_ff_to_e4m3x2_rn : NVPTXBuiltinSMAndPTX<"short(float, float)", SM_89, PTX81>;
585594
def __nvvm_ff_to_e4m3x2_rn_relu : NVPTXBuiltinSMAndPTX<"short(float, float)", SM_89, PTX81>;
@@ -596,6 +605,28 @@ def __nvvm_e4m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
596605
def __nvvm_e5m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
597606
def __nvvm_e5m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
598607

608+
def __nvvm_ff_to_e2m3x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
609+
def __nvvm_ff_to_e2m3x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
610+
def __nvvm_ff_to_e3m2x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
611+
def __nvvm_ff_to_e3m2x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
612+
613+
def __nvvm_e2m3x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
614+
def __nvvm_e2m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
615+
def __nvvm_e3m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
616+
def __nvvm_e3m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
617+
618+
def __nvvm_ff_to_ue8m0x2_rz : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
619+
def __nvvm_ff_to_ue8m0x2_rz_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
620+
def __nvvm_ff_to_ue8m0x2_rp : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
621+
def __nvvm_ff_to_ue8m0x2_rp_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
622+
623+
def __nvvm_bf16x2_to_ue8m0x2_rz : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
624+
def __nvvm_bf16x2_to_ue8m0x2_rz_satfinite : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
625+
def __nvvm_bf16x2_to_ue8m0x2_rp : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
626+
def __nvvm_bf16x2_to_ue8m0x2_rp_satfinite : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
627+
628+
def __nvvm_ue8m0x2_to_bf16x2 : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
629+
599630
// FNS
600631
let Attributes = [NoThrow] in {
601632
def __nvvm_fns : NVPTXBuiltinPTX<"unsigned int(unsigned int, unsigned int, int)", PTX60>;

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/include/clang/Driver/SanitizerArgs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class SanitizerArgs {
105105
bool requiresMinimalRuntime() const { return MinimalRuntime; }
106106
bool needsDfsanRt() const { return Sanitizers.has(SanitizerKind::DataFlow); }
107107
bool needsSafeStackRt() const { return SafeStackRuntime; }
108-
bool needsCfiRt() const;
109-
bool needsCfiDiagRt() const;
108+
bool needsCfiCrossDsoRt() const;
109+
bool needsCfiCrossDsoDiagRt() const;
110110
bool needsStatsRt() const { return Stats; }
111111
bool needsScudoRt() const { return Sanitizers.has(SanitizerKind::Scudo); }
112112
bool needsNsanRt() const {

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;

0 commit comments

Comments
 (0)