Skip to content

Commit f6cff66

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into sret_fixes
2 parents b5a7df0 + 0f8dbb2 commit f6cff66

File tree

218 files changed

+5606
-2028
lines changed

Some content is hidden

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

218 files changed

+5606
-2028
lines changed

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,6 +2577,7 @@ struct CFISnapshot {
25772577
case MCCFIInstruction::OpAdjustCfaOffset:
25782578
case MCCFIInstruction::OpWindowSave:
25792579
case MCCFIInstruction::OpNegateRAState:
2580+
case MCCFIInstruction::OpNegateRAStateWithPC:
25802581
case MCCFIInstruction::OpLLVMDefAspaceCfa:
25812582
case MCCFIInstruction::OpLabel:
25822583
llvm_unreachable("unsupported CFI opcode");
@@ -2715,6 +2716,7 @@ struct CFISnapshotDiff : public CFISnapshot {
27152716
case MCCFIInstruction::OpAdjustCfaOffset:
27162717
case MCCFIInstruction::OpWindowSave:
27172718
case MCCFIInstruction::OpNegateRAState:
2719+
case MCCFIInstruction::OpNegateRAStateWithPC:
27182720
case MCCFIInstruction::OpLLVMDefAspaceCfa:
27192721
case MCCFIInstruction::OpLabel:
27202722
llvm_unreachable("unsupported CFI opcode");
@@ -2864,6 +2866,7 @@ BinaryFunction::unwindCFIState(int32_t FromState, int32_t ToState,
28642866
case MCCFIInstruction::OpAdjustCfaOffset:
28652867
case MCCFIInstruction::OpWindowSave:
28662868
case MCCFIInstruction::OpNegateRAState:
2869+
case MCCFIInstruction::OpNegateRAStateWithPC:
28672870
case MCCFIInstruction::OpLLVMDefAspaceCfa:
28682871
case MCCFIInstruction::OpLabel:
28692872
llvm_unreachable("unsupported CFI opcode");

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,13 @@ unsigned getNumberOfDesignated(const InitListExpr *SyntacticInitList) {
8080
});
8181
}
8282

83-
AST_MATCHER(CXXRecordDecl, isAggregate) { return Node.isAggregate(); }
83+
AST_MATCHER(CXXRecordDecl, isAggregate) {
84+
return Node.hasDefinition() && Node.isAggregate();
85+
}
8486

85-
AST_MATCHER(CXXRecordDecl, isPOD) { return Node.isPOD(); }
87+
AST_MATCHER(CXXRecordDecl, isPOD) {
88+
return Node.hasDefinition() && Node.isPOD();
89+
}
8690

8791
AST_MATCHER(InitListExpr, isFullyDesignated) {
8892
if (const InitListExpr *SyntacticForm =

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ Changes in existing checks
216216
a false positive when only an implicit conversion happened inside an
217217
initializer list.
218218

219+
- Improved :doc:`modernize-use-designated-initializers
220+
<clang-tidy/checks/modernize/use-designated-initializers>` check to fix a
221+
crash when a class is declared but not defined.
222+
219223
- Improved :doc:`modernize-use-nullptr
220224
<clang-tidy/checks/modernize/use-nullptr>` check to also recognize
221225
``NULL``/``__null`` (but not ``0``) when used with a templated type.

clang-tools-extra/test/clang-tidy/checkers/modernize/use-designated-initializers.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,11 @@ DECLARE_S93;
201201
// CHECK-MESSAGES-MACROS: :[[@LINE-1]]:1: warning: use designated initializer list to initialize 'S9' [modernize-use-designated-initializers]
202202
// CHECK-MESSAGES-MACROS: :[[@LINE-4]]:28: note: expanded from macro 'DECLARE_S93'
203203
// CHECK-MESSAGES-MACROS: :[[@LINE-71]]:1: note: aggregate type is defined here
204+
205+
// Issue #113652.
206+
struct S14;
207+
208+
struct S15{
209+
S15(S14& d):d{d}{}
210+
S14& d;
211+
};

clang/Maintainers.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ AST matchers
3333
| aaron\@aaronballman.com (email), aaron.ballman (Phabricator), AaronBallman (GitHub), AaronBallman (Discourse), aaronballman (Discord), AaronBallman (IRC)
3434
3535

36+
AST Visitors
37+
~~~~~~~~~~~~
38+
| Sirraide
39+
| aeternalmail\@gmail.com (email), Sirraide (GitHub), Ætérnal (Discord), Sirraide (Discourse)
40+
41+
3642
Clang LLVM IR generation
3743
~~~~~~~~~~~~~~~~~~~~~~~~
3844
| John McCall
@@ -57,6 +63,12 @@ Analysis & CFG
5763
| sgatev\@google.com (email), sgatev (Phabricator), sgatev (GitHub)
5864
5965

66+
Sema
67+
~~~~
68+
| Sirraide
69+
| aeternalmail\@gmail.com (email), Sirraide (GitHub), Ætérnal (Discord), Sirraide (Discourse)
70+
71+
6072
Experimental new constant interpreter
6173
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6274
| Timm Bäder
@@ -71,13 +83,22 @@ Modules & serialization
7183
| Michael Spencer
7284
| bigcheesegs\@gmail.com (email), Bigcheese (Phabricator), Bigcheese (GitHub)
7385
86+
| Vassil Vassilev
87+
| Vassil.Vassilev\@cern.ch (email), v.g.vassilev (Phabricator), vgvassilev (GitHub)
88+
7489

7590
Templates
7691
~~~~~~~~~
7792
| Erich Keane
7893
| ekeane\@nvidia.com (email), ErichKeane (Phabricator), erichkeane (GitHub)
7994
8095

96+
Lambdas
97+
~~~~~~~
98+
| Corentin Jabot
99+
| corentin.jabot\@gmail.com (email), cor3ntin (Phabricator), cor3ntin (GitHub)
100+
101+
81102
Debug information
82103
~~~~~~~~~~~~~~~~~
83104
| Adrian Prantl
@@ -172,6 +193,12 @@ Attributes
172193
| ekeane\@nvidia.com (email), ErichKeane (Phabricator), erichkeane (GitHub)
173194
174195

196+
Plugins
197+
~~~~~~~
198+
| Vassil Vassilev
199+
| Vassil.Vassilev\@cern.ch (email), v.g.vassilev (Phabricator), vgvassilev (GitHub)
200+
201+
175202
Inline assembly
176203
~~~~~~~~~~~~~~~
177204
| Eric Christopher
@@ -225,6 +252,12 @@ C++ conformance
225252
| Hubert Tong
226253
| hubert.reinterpretcast\@gmail.com (email), hubert.reinterpretcast (Phabricator), hubert-reinterpretcast (GitHub)
227254
255+
| Shafik Yaghmour
256+
| shafik.yaghmour\@intel.com (email), shafik (GitHub), shafik.yaghmour (Discord), shafik (Discourse)
257+
258+
| Vlad Serebrennikov
259+
| serebrennikov.vladislav\@gmail.com (email), Endilll (GitHub), Endill (Discord), Endill (Discourse)
260+
228261

229262
C++ Defect Reports
230263
~~~~~~~~~~~~~~~~~~

clang/include/clang/AST/ASTContext.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
239239
mutable llvm::ContextualFoldingSet<DependentTemplateSpecializationType,
240240
ASTContext&>
241241
DependentTemplateSpecializationTypes;
242-
llvm::FoldingSet<PackExpansionType> PackExpansionTypes;
242+
mutable llvm::FoldingSet<PackExpansionType> PackExpansionTypes;
243243
mutable llvm::FoldingSet<ObjCObjectTypeImpl> ObjCObjectTypes;
244244
mutable llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
245245
mutable llvm::FoldingSet<DependentUnaryTransformType>
@@ -1778,13 +1778,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
17781778
ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
17791779
const IdentifierInfo *Name, ArrayRef<TemplateArgument> Args) const;
17801780

1781-
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl);
1782-
1783-
/// Get a template argument list with one argument per template parameter
1784-
/// in a template parameter list, such as for the injected class name of
1785-
/// a class template.
1786-
void getInjectedTemplateArgs(const TemplateParameterList *Params,
1787-
SmallVectorImpl<TemplateArgument> &Args);
1781+
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl) const;
17881782

17891783
/// Form a pack expansion type with the given pattern.
17901784
/// \param NumExpansions The number of expansions for the pack, if known.
@@ -1795,7 +1789,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
17951789
/// if this is the canonical type of another pack expansion type.
17961790
QualType getPackExpansionType(QualType Pattern,
17971791
std::optional<unsigned> NumExpansions,
1798-
bool ExpectPackInType = true);
1792+
bool ExpectPackInType = true) const;
17991793

18001794
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
18011795
ObjCInterfaceDecl *PrevDecl = nullptr) const;

clang/include/clang/AST/DeclTemplate.h

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ NamedDecl *getAsNamedDecl(TemplateParameter P);
7171
class TemplateParameterList final
7272
: private llvm::TrailingObjects<TemplateParameterList, NamedDecl *,
7373
Expr *> {
74+
/// The template argument list of the template parameter list.
75+
TemplateArgument *InjectedArgs = nullptr;
76+
7477
/// The location of the 'template' keyword.
7578
SourceLocation TemplateLoc;
7679

@@ -196,6 +199,9 @@ class TemplateParameterList final
196199

197200
bool hasAssociatedConstraints() const;
198201

202+
/// Get the template argument list of the template parameter list.
203+
ArrayRef<TemplateArgument> getInjectedTemplateArgs(const ASTContext &Context);
204+
199205
SourceLocation getTemplateLoc() const { return TemplateLoc; }
200206
SourceLocation getLAngleLoc() const { return LAngleLoc; }
201207
SourceLocation getRAngleLoc() const { return RAngleLoc; }
@@ -793,15 +799,6 @@ class RedeclarableTemplateDecl : public TemplateDecl,
793799
/// The first value in the array is the number of specializations/partial
794800
/// specializations that follow.
795801
GlobalDeclID *LazySpecializations = nullptr;
796-
797-
/// The set of "injected" template arguments used within this
798-
/// template.
799-
///
800-
/// This pointer refers to the template arguments (there are as
801-
/// many template arguments as template parameters) for the
802-
/// template, and is allocated lazily, since most templates do not
803-
/// require the use of this information.
804-
TemplateArgument *InjectedArgs = nullptr;
805802
};
806803

807804
/// Pointer to the common data shared by all declarations of this
@@ -927,7 +924,10 @@ class RedeclarableTemplateDecl : public TemplateDecl,
927924
/// Although the C++ standard has no notion of the "injected" template
928925
/// arguments for a template, the notion is convenient when
929926
/// we need to perform substitutions inside the definition of a template.
930-
ArrayRef<TemplateArgument> getInjectedTemplateArgs();
927+
ArrayRef<TemplateArgument>
928+
getInjectedTemplateArgs(const ASTContext &Context) const {
929+
return getTemplateParameters()->getInjectedTemplateArgs(Context);
930+
}
931931

932932
using redecl_range = redeclarable_base::redecl_range;
933933
using redecl_iterator = redeclarable_base::redecl_iterator;
@@ -2087,10 +2087,6 @@ class ClassTemplatePartialSpecializationDecl
20872087
/// The list of template parameters
20882088
TemplateParameterList *TemplateParams = nullptr;
20892089

2090-
/// The set of "injected" template arguments used within this
2091-
/// partial specialization.
2092-
TemplateArgument *InjectedArgs = nullptr;
2093-
20942090
/// The class template partial specialization from which this
20952091
/// class template partial specialization was instantiated.
20962092
///
@@ -2136,9 +2132,11 @@ class ClassTemplatePartialSpecializationDecl
21362132
return TemplateParams;
21372133
}
21382134

2139-
/// Retrieve the template arguments list of the template parameter list
2140-
/// of this template.
2141-
ArrayRef<TemplateArgument> getInjectedTemplateArgs();
2135+
/// Get the template argument list of the template parameter list.
2136+
ArrayRef<TemplateArgument>
2137+
getInjectedTemplateArgs(const ASTContext &Context) const {
2138+
return getTemplateParameters()->getInjectedTemplateArgs(Context);
2139+
}
21422140

21432141
/// \brief All associated constraints of this partial specialization,
21442142
/// including the requires clause and any constraints derived from
@@ -2864,10 +2862,6 @@ class VarTemplatePartialSpecializationDecl
28642862
/// The list of template parameters
28652863
TemplateParameterList *TemplateParams = nullptr;
28662864

2867-
/// The set of "injected" template arguments used within this
2868-
/// partial specialization.
2869-
TemplateArgument *InjectedArgs = nullptr;
2870-
28712865
/// The variable template partial specialization from which this
28722866
/// variable template partial specialization was instantiated.
28732867
///
@@ -2914,9 +2908,11 @@ class VarTemplatePartialSpecializationDecl
29142908
return TemplateParams;
29152909
}
29162910

2917-
/// Retrieve the template arguments list of the template parameter list
2918-
/// of this template.
2919-
ArrayRef<TemplateArgument> getInjectedTemplateArgs();
2911+
/// Get the template argument list of the template parameter list.
2912+
ArrayRef<TemplateArgument>
2913+
getInjectedTemplateArgs(const ASTContext &Context) const {
2914+
return getTemplateParameters()->getInjectedTemplateArgs(Context);
2915+
}
29202916

29212917
/// \brief All associated constraints of this partial specialization,
29222918
/// including the requires clause and any constraints derived from

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4678,7 +4678,8 @@ def malign_loops_EQ : Joined<["-"], "malign-loops=">, Group<clang_ignored_m_Grou
46784678
def malign_jumps_EQ : Joined<["-"], "malign-jumps=">, Group<clang_ignored_m_Group>;
46794679

46804680
let Flags = [TargetSpecific] in {
4681-
def mabi_EQ : Joined<["-"], "mabi=">, Group<m_Group>;
4681+
def mabi_EQ : Joined<["-"], "mabi=">, Group<m_Group>,
4682+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
46824683
def malign_branch_EQ : CommaJoined<["-"], "malign-branch=">, Group<m_Group>,
46834684
HelpText<"Specify types of branches to align">;
46844685
def malign_branch_boundary_EQ : Joined<["-"], "malign-branch-boundary=">, Group<m_Group>,
@@ -7363,6 +7364,7 @@ def mabi_EQ_ieeelongdouble : Flag<["-"], "mabi=ieeelongdouble">,
73637364
HelpText<"Use IEEE 754 quadruple-precision for long double">,
73647365
MarshallingInfoFlag<LangOpts<"PPCIEEELongDouble">>;
73657366
def mabi_EQ_vec_extabi : Flag<["-"], "mabi=vec-extabi">,
7367+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
73667368
HelpText<"Enable the extended Altivec ABI on AIX. Use volatile and nonvolatile vector registers">,
73677369
MarshallingInfoFlag<LangOpts<"EnableAIXExtendedAltivecABI">>;
73687370
def mfloat_abi : Separate<["-"], "mfloat-abi">,

clang/lib/AST/ASTContext.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5634,7 +5634,7 @@ ASTContext::getDependentTemplateSpecializationType(
56345634
return QualType(T, 0);
56355635
}
56365636

5637-
TemplateArgument ASTContext::getInjectedTemplateArg(NamedDecl *Param) {
5637+
TemplateArgument ASTContext::getInjectedTemplateArg(NamedDecl *Param) const {
56385638
TemplateArgument Arg;
56395639
if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
56405640
QualType ArgType = getTypeDeclType(TTP);
@@ -5678,23 +5678,15 @@ TemplateArgument ASTContext::getInjectedTemplateArg(NamedDecl *Param) {
56785678
}
56795679

56805680
if (Param->isTemplateParameterPack())
5681-
Arg = TemplateArgument::CreatePackCopy(*this, Arg);
5681+
Arg =
5682+
TemplateArgument::CreatePackCopy(const_cast<ASTContext &>(*this), Arg);
56825683

56835684
return Arg;
56845685
}
56855686

5686-
void
5687-
ASTContext::getInjectedTemplateArgs(const TemplateParameterList *Params,
5688-
SmallVectorImpl<TemplateArgument> &Args) {
5689-
Args.reserve(Args.size() + Params->size());
5690-
5691-
for (NamedDecl *Param : *Params)
5692-
Args.push_back(getInjectedTemplateArg(Param));
5693-
}
5694-
56955687
QualType ASTContext::getPackExpansionType(QualType Pattern,
56965688
std::optional<unsigned> NumExpansions,
5697-
bool ExpectPackInType) {
5689+
bool ExpectPackInType) const {
56985690
assert((!ExpectPackInType || Pattern->containsUnexpandedParameterPack()) &&
56995691
"Pack expansions must expand one or more parameter packs");
57005692

0 commit comments

Comments
 (0)