Skip to content

Commit ac4966d

Browse files
committed
Merge from 'main' to 'sycl-web' (60 commits)
CONFLICT (content): Merge conflict in llvm/include/llvm/Analysis/TargetLibraryInfo.h
2 parents 3ca3980 + 7e928f9 commit ac4966d

File tree

242 files changed

+22960
-7447
lines changed

Some content is hidden

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

242 files changed

+22960
-7447
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,9 @@ void ClangTidyDiagnosticConsumer::forwardDiagnostic(const Diagnostic &Info) {
544544
case clang::DiagnosticsEngine::ak_attr:
545545
Builder << reinterpret_cast<Attr *>(Info.getRawArg(Index));
546546
break;
547+
case clang::DiagnosticsEngine::ak_attr_info:
548+
Builder << reinterpret_cast<AttributeCommonInfo *>(Info.getRawArg(Index));
549+
break;
547550
case clang::DiagnosticsEngine::ak_addrspace:
548551
Builder << static_cast<LangAS>(Info.getRawArg(Index));
549552
break;

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ Bug Fixes to C++ Support
898898
- Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107)
899899
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
900900
- Fixed a function declaration mismatch that caused inconsistencies between concepts and variable template declarations. (#GH139476)
901+
- Fixed an out-of-line declaration mismatch involving nested template parameters. (#GH145521)
901902
- Clang no longer segfaults when there is a configuration mismatch between modules and their users (http://crbug.com/400353616).
902903
- Fix an incorrect deduction when calling an explicit object member function template through an overload set address.
903904
- Fixed bug in constant evaluation that would allow using the value of a
@@ -912,6 +913,7 @@ Bug Fixes to C++ Support
912913
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
913914
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
914915
- Fixed a crash when handling invalid member using-declaration in C++20+ mode. (#GH63254)
916+
- Fix a crash when trying to instantiate an ambiguous specialization. (#GH51866)
915917

916918
Bug Fixes to AST Handling
917919
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/Expr.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3586,6 +3586,10 @@ class CompoundLiteralExpr : public Expr {
35863586
/// The int part of the pair stores whether this expr is file scope.
35873587
llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
35883588
Stmt *Init;
3589+
3590+
/// Value of constant literals with static storage duration.
3591+
mutable APValue *StaticValue = nullptr;
3592+
35893593
public:
35903594
CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo,
35913595
QualType T, ExprValueKind VK, Expr *init, bool fileScope)
@@ -3615,6 +3619,10 @@ class CompoundLiteralExpr : public Expr {
36153619
TInfoAndScope.setPointer(tinfo);
36163620
}
36173621

3622+
bool hasStaticStorage() const { return isFileScope() && isGLValue(); }
3623+
APValue &getOrCreateStaticValue(ASTContext &Ctx) const;
3624+
APValue &getStaticValue() const;
3625+
36183626
SourceLocation getBeginLoc() const LLVM_READONLY {
36193627
// FIXME: Init should never be null.
36203628
if (!Init)

clang/include/clang/Basic/DiagnosticCommentKinds.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ def warn_doc_api_container_decl_mismatch : Warning<
9090
InGroup<Documentation>, DefaultIgnore;
9191

9292
def warn_doc_container_decl_mismatch : Warning<
93-
"'%select{\\|@}0%select{classdesign|coclass|dependency|helper"
94-
"|helperclass|helps|instancesize|ownership|performance|security|superclass}1' "
93+
"'%select{\\|@}0%enum_select<DocCommandKind>{%ClassDesign{classdesign}|"
94+
"%CoClass{coclass}|%Dependency{dependency}|%Helper{helper}|%HelperClass{helperclass}|"
95+
"%Helps{helps}|%InstanceSize{instancesize}|%Ownership{ownership}|"
96+
"%Performance{performance}|%Security{security}|%Superclass{superclass}}1' "
9597
"command should not be used in a comment attached to a non-container declaration">,
9698
InGroup<Documentation>, DefaultIgnore;
9799

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,10 @@ def note_unsatisfied_trait_reason
18831883
"%DeletedAssign{has a deleted %select{copy|move}1 "
18841884
"assignment operator}|"
18851885
"%UnionWithUserDeclaredSMF{is a union with a user-declared "
1886-
"%sub{select_special_member_kind}1}"
1886+
"%sub{select_special_member_kind}1}|"
1887+
"%FunctionType{is a function type}|"
1888+
"%CVVoidType{is a cv void type}|"
1889+
"%IncompleteArrayType{is an incomplete array type}"
18871890
"}0">;
18881891

18891892
def warn_consteval_if_always_true : Warning<

clang/include/clang/Basic/arm_sve.td

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -264,22 +264,22 @@ let SVETargetGuard = "sve,bf16", SMETargetGuard = "sme,bf16" in {
264264
def SVLD1RQ_BF : SInst<"svld1rq[_{2}]", "dPc", "b", MergeNone, "aarch64_sve_ld1rq", [VerifyRuntimeMode]>;
265265
}
266266

267-
multiclass StructLoad<string name, string proto, string i> {
268-
def : SInst<name, proto, "csilUcUsUiUlhfdm", MergeNone, i, [IsStructLoad, VerifyRuntimeMode]>;
267+
multiclass StructLoad<string name, string proto, string i, list<FlagType> f = []> {
268+
def : SInst<name, proto, "csilUcUsUiUlhfdm", MergeNone, i, !listconcat(f, [IsStructLoad])>;
269269
let SVETargetGuard = "sve,bf16", SMETargetGuard = "sme,bf16" in {
270-
def: SInst<name, proto, "b", MergeNone, i, [IsStructLoad, VerifyRuntimeMode]>;
270+
def: SInst<name, proto, "b", MergeNone, i, !listconcat(f, [IsStructLoad])>;
271271
}
272272
}
273273

274274
// Load N-element structure into N vectors (scalar base)
275-
defm SVLD2 : StructLoad<"svld2[_{2}]", "2Pc", "aarch64_sve_ld2_sret">;
276-
defm SVLD3 : StructLoad<"svld3[_{2}]", "3Pc", "aarch64_sve_ld3_sret">;
277-
defm SVLD4 : StructLoad<"svld4[_{2}]", "4Pc", "aarch64_sve_ld4_sret">;
275+
defm SVLD2 : StructLoad<"svld2[_{2}]", "2Pc", "aarch64_sve_ld2_sret", [VerifyRuntimeMode]>;
276+
defm SVLD3 : StructLoad<"svld3[_{2}]", "3Pc", "aarch64_sve_ld3_sret", [VerifyRuntimeMode]>;
277+
defm SVLD4 : StructLoad<"svld4[_{2}]", "4Pc", "aarch64_sve_ld4_sret", [VerifyRuntimeMode]>;
278278

279279
// Load N-element structure into N vectors (scalar base, VL displacement)
280-
defm SVLD2_VNUM : StructLoad<"svld2_vnum[_{2}]", "2Pcl", "aarch64_sve_ld2_sret">;
281-
defm SVLD3_VNUM : StructLoad<"svld3_vnum[_{2}]", "3Pcl", "aarch64_sve_ld3_sret">;
282-
defm SVLD4_VNUM : StructLoad<"svld4_vnum[_{2}]", "4Pcl", "aarch64_sve_ld4_sret">;
280+
defm SVLD2_VNUM : StructLoad<"svld2_vnum[_{2}]", "2Pcl", "aarch64_sve_ld2_sret", [VerifyRuntimeMode]>;
281+
defm SVLD3_VNUM : StructLoad<"svld3_vnum[_{2}]", "3Pcl", "aarch64_sve_ld3_sret", [VerifyRuntimeMode]>;
282+
defm SVLD4_VNUM : StructLoad<"svld4_vnum[_{2}]", "4Pcl", "aarch64_sve_ld4_sret", [VerifyRuntimeMode]>;
283283

284284
// Load one octoword and replicate (scalar base)
285285
let SVETargetGuard = "sve,f64mm", SMETargetGuard = InvalidMode in {
@@ -434,21 +434,21 @@ def SVST1H_SCATTER_INDEX_S : MInst<"svst1h_scatter[_{2}base]_index[_{d}]", "v
434434
def SVST1W_SCATTER_INDEX_S : MInst<"svst1w_scatter[_{2}base]_index[_{d}]", "vPuld", "lUl", [IsScatterStore], MemEltTyInt32, "aarch64_sve_st1_scatter_scalar_offset">;
435435
} // let SVETargetGuard = "sve"
436436

437-
multiclass StructStore<string name, string proto, string i> {
438-
def : SInst<name, proto, "csilUcUsUiUlhfdm", MergeNone, i, [IsStructStore, VerifyRuntimeMode]>;
437+
multiclass StructStore<string name, string proto, string i, list<FlagType> f = []> {
438+
def : SInst<name, proto, "csilUcUsUiUlhfdm", MergeNone, i, !listconcat(f, [IsStructStore])>;
439439
let SVETargetGuard = "sve,bf16", SMETargetGuard = "sme,bf16" in {
440-
def: SInst<name, proto, "b", MergeNone, i, [IsStructStore, VerifyRuntimeMode]>;
440+
def: SInst<name, proto, "b", MergeNone, i, !listconcat(f, [IsStructStore])>;
441441
}
442442
}
443443
// Store N vectors into N-element structure (scalar base)
444-
defm SVST2 : StructStore<"svst2[_{d}]", "vPp2", "aarch64_sve_st2">;
445-
defm SVST3 : StructStore<"svst3[_{d}]", "vPp3", "aarch64_sve_st3">;
446-
defm SVST4 : StructStore<"svst4[_{d}]", "vPp4", "aarch64_sve_st4">;
444+
defm SVST2 : StructStore<"svst2[_{d}]", "vPp2", "aarch64_sve_st2", [VerifyRuntimeMode]>;
445+
defm SVST3 : StructStore<"svst3[_{d}]", "vPp3", "aarch64_sve_st3", [VerifyRuntimeMode]>;
446+
defm SVST4 : StructStore<"svst4[_{d}]", "vPp4", "aarch64_sve_st4", [VerifyRuntimeMode]>;
447447

448448
// Store N vectors into N-element structure (scalar base, VL displacement)
449-
defm SVST2_VNUM : StructStore<"svst2_vnum[_{d}]", "vPpl2", "aarch64_sve_st2">;
450-
defm SVST3_VNUM : StructStore<"svst3_vnum[_{d}]", "vPpl3", "aarch64_sve_st3">;
451-
defm SVST4_VNUM : StructStore<"svst4_vnum[_{d}]", "vPpl4", "aarch64_sve_st4">;
449+
defm SVST2_VNUM : StructStore<"svst2_vnum[_{d}]", "vPpl2", "aarch64_sve_st2", [VerifyRuntimeMode]>;
450+
defm SVST3_VNUM : StructStore<"svst3_vnum[_{d}]", "vPpl3", "aarch64_sve_st3", [VerifyRuntimeMode]>;
451+
defm SVST4_VNUM : StructStore<"svst4_vnum[_{d}]", "vPpl4", "aarch64_sve_st4", [VerifyRuntimeMode]>;
452452

453453
// Store one vector, with no truncation, non-temporal (scalar base)
454454
def SVSTNT1 : MInst<"svstnt1[_{d}]", "vPpd", "csilUcUsUiUlhfdm", [IsStore, VerifyRuntimeMode], MemEltTyDefault, "aarch64_sve_stnt1">;

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5629,6 +5629,9 @@ bool Compiler<Emitter>::visitContinueStmt(const ContinueStmt *S) {
56295629
template <class Emitter>
56305630
bool Compiler<Emitter>::visitSwitchStmt(const SwitchStmt *S) {
56315631
const Expr *Cond = S->getCond();
5632+
if (Cond->containsErrors())
5633+
return false;
5634+
56325635
PrimType CondT = this->classifyPrim(Cond->getType());
56335636
LocalScope<Emitter> LS(this);
56345637

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2208,15 +2208,27 @@ static bool interp__builtin_is_within_lifetime(InterpState &S, CodePtr OpPC,
22082208
if (Ptr.isOnePastEnd())
22092209
return Error(1);
22102210

2211-
bool Result = true;
2211+
bool Result = Ptr.getLifetime() != Lifetime::Ended;
22122212
if (!Ptr.isActive()) {
22132213
Result = false;
22142214
} else {
22152215
if (!CheckLive(S, OpPC, Ptr, AK_Read))
22162216
return false;
22172217
if (!CheckMutable(S, OpPC, Ptr))
22182218
return false;
2219+
if (!CheckDummy(S, OpPC, Ptr, AK_Read))
2220+
return false;
2221+
}
2222+
2223+
// Check if we're currently running an initializer.
2224+
for (InterpFrame *Frame = S.Current; Frame; Frame = Frame->Caller) {
2225+
if (const Function *F = Frame->getFunction();
2226+
F && F->isConstructor() && Frame->getThis().block() == Ptr.block()) {
2227+
return Error(2);
2228+
}
22192229
}
2230+
if (S.EvaluatingDecl && Ptr.getDeclDesc()->asVarDecl() == S.EvaluatingDecl)
2231+
return Error(2);
22202232

22212233
pushInteger(S, Result, Call->getType());
22222234
return true;

clang/lib/AST/CommentSema.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -171,50 +171,49 @@ void Sema::checkContainerDecl(const BlockCommandComment *Comment) {
171171
const CommandInfo *Info = Traits.getCommandInfo(Comment->getCommandID());
172172
if (!Info->IsRecordLikeDetailCommand || isRecordLikeDecl())
173173
return;
174-
unsigned DiagSelect;
174+
std::optional<unsigned> DiagSelect;
175175
switch (Comment->getCommandID()) {
176176
case CommandTraits::KCI_classdesign:
177-
DiagSelect = 1;
177+
DiagSelect = diag::DocCommandKind::ClassDesign;
178178
break;
179179
case CommandTraits::KCI_coclass:
180-
DiagSelect = 2;
180+
DiagSelect = diag::DocCommandKind::CoClass;
181181
break;
182182
case CommandTraits::KCI_dependency:
183-
DiagSelect = 3;
183+
DiagSelect = diag::DocCommandKind::Dependency;
184184
break;
185185
case CommandTraits::KCI_helper:
186-
DiagSelect = 4;
186+
DiagSelect = diag::DocCommandKind::Helper;
187187
break;
188188
case CommandTraits::KCI_helperclass:
189-
DiagSelect = 5;
189+
DiagSelect = diag::DocCommandKind::HelperClass;
190190
break;
191191
case CommandTraits::KCI_helps:
192-
DiagSelect = 6;
192+
DiagSelect = diag::DocCommandKind::Helps;
193193
break;
194194
case CommandTraits::KCI_instancesize:
195-
DiagSelect = 7;
195+
DiagSelect = diag::DocCommandKind::InstanceSize;
196196
break;
197197
case CommandTraits::KCI_ownership:
198-
DiagSelect = 8;
198+
DiagSelect = diag::DocCommandKind::Ownership;
199199
break;
200200
case CommandTraits::KCI_performance:
201-
DiagSelect = 9;
201+
DiagSelect = diag::DocCommandKind::Performance;
202202
break;
203203
case CommandTraits::KCI_security:
204-
DiagSelect = 10;
204+
DiagSelect = diag::DocCommandKind::Security;
205205
break;
206206
case CommandTraits::KCI_superclass:
207-
DiagSelect = 11;
207+
DiagSelect = diag::DocCommandKind::Superclass;
208208
break;
209209
default:
210-
DiagSelect = 0;
210+
DiagSelect = std::nullopt;
211211
break;
212212
}
213213
if (DiagSelect)
214214
Diag(Comment->getLocation(), diag::warn_doc_container_decl_mismatch)
215-
<< Comment->getCommandMarker()
216-
<< (DiagSelect-1)
217-
<< Comment->getSourceRange();
215+
<< Comment->getCommandMarker() << (*DiagSelect)
216+
<< Comment->getSourceRange();
218217
}
219218

220219
/// Turn a string into the corresponding PassDirection or -1 if it's not

clang/lib/AST/Expr.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5503,3 +5503,17 @@ ConvertVectorExpr *ConvertVectorExpr::Create(
55035503
return new (Mem) ConvertVectorExpr(SrcExpr, TI, DstType, VK, OK, BuiltinLoc,
55045504
RParenLoc, FPFeatures);
55055505
}
5506+
5507+
APValue &CompoundLiteralExpr::getOrCreateStaticValue(ASTContext &Ctx) const {
5508+
assert(hasStaticStorage());
5509+
if (!StaticValue) {
5510+
StaticValue = new (Ctx) APValue;
5511+
Ctx.addDestruction(StaticValue);
5512+
}
5513+
return *StaticValue;
5514+
}
5515+
5516+
APValue &CompoundLiteralExpr::getStaticValue() const {
5517+
assert(StaticValue);
5518+
return *StaticValue;
5519+
}

0 commit comments

Comments
 (0)