Skip to content

Commit 18e8abd

Browse files
authored
Merge branch 'main' into fix-AIX
2 parents 2c2ddcc + 0f8dbb2 commit 18e8abd

File tree

358 files changed

+12692
-2938
lines changed

Some content is hidden

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

358 files changed

+12692
-2938
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: 45 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,18 @@ 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+
261+
262+
C++ Defect Reports
263+
~~~~~~~~~~~~~~~~~~
264+
| Vlad Serebrennikov
265+
| serebrennikov.vladislav\@gmail.com (email), Endilll (GitHub), Endill (Discord), Endill (Discourse)
266+
228267

229268
Objective-C/C++ conformance
230269
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -244,6 +283,12 @@ OpenCL conformance
244283
| anastasia\@compiler-experts.com (email), Anastasia (Phabricator), AnastasiaStulova (GitHub)
245284
246285

286+
OpenACC
287+
~~~~~~~
288+
| Erich Keane
289+
| ekeane\@nvidia.com (email), ErichKeane (Phabricator), erichkeane (GitHub)
290+
291+
247292
SYCL conformance
248293
~~~~~~~~~~~~~~~~
249294
| Alexey Bader

clang/docs/FunctionEffectAnalysis.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ attached to functions, blocks, function pointers, lambdas, and member functions.
5454
The attribute applies only to the function itself. In particular, it does not apply to any nested
5555
functions or declarations, such as blocks, lambdas, and local classes.
5656

57-
This document uses the C++/C23 syntax ``[[clang::nonblocking]]``, since it parallels the placement
57+
This document uses the C++/C23 syntax ``[[clang::nonblocking]]``, since it parallels the placement
5858
of the ``noexcept`` specifier, and the attributes have other similarities to ``noexcept``. The GNU
59-
``__attribute__((nonblocking))`` syntax is also supported. Note that it requires a different
59+
``__attribute__((nonblocking))`` syntax is also supported. Note that it requires a different
6060
placement on a C++ type alias.
6161

6262
Like ``noexcept``, ``nonblocking`` and ``nonallocating`` have an optional argument, a compile-time
@@ -76,10 +76,10 @@ series of performance constraints. From weakest to strongest:
7676
- ``nonblocking``: The function type will never block on a lock, allocate memory on the heap,
7777
or throw an exception.
7878

79-
``nonblocking`` includes the ``nonallocating`` guarantee.
79+
``nonblocking`` includes the ``nonallocating`` guarantee.
8080

8181
While ``nonblocking`` and ``nonallocating`` are conceptually a superset of ``noexcept``, neither
82-
attribute implicitly specifies ``noexcept``. Further, ``noexcept`` has a specified runtime behavior of
82+
attribute implicitly specifies ``noexcept``. Further, ``noexcept`` has a specified runtime behavior of
8383
aborting if an exception is thrown, while the ``nonallocating`` and ``nonblocking`` attributes are
8484
mainly for compile-time analysis and have no runtime behavior, except in code built
8585
with Clang's :doc:`RealtimeSanitizer`. Nonetheless, Clang emits a
@@ -95,7 +95,7 @@ function, as described in the section "Analysis and warnings", below.
9595
explicitly disable any potential inference of ``nonblocking`` or ``nonallocating`` during
9696
verification. (Inference is described later in this document). ``nonblocking(false)`` and
9797
``nonallocating(false)`` are legal, but superfluous when applied to a function *type*
98-
that is not part of a declarator: ``float (int) [[nonblocking(false)]]`` and
98+
that is not part of a declarator: ``float (int) [[nonblocking(false)]]`` and
9999
``float (int)`` are identical types.
100100

101101
For functions with no explicit performance constraint, the worst is assumed: the function
@@ -153,7 +153,7 @@ are comparable to that for ``noexcept`` in C++17 and later.
153153
void (*fp_nonallocating)() [[clang::nonallocating]];
154154
fp_nonallocating = nullptr;
155155
fp_nonallocating = nonallocating;
156-
fp_nonallocating = nonblocking; // no warning because nonblocking includes nonallocating
156+
fp_nonallocating = nonblocking; // no warning because nonblocking includes nonallocating
157157
fp_nonallocating = unannotated;
158158
// ^ warning: attribute 'nonallocating' should not be added via type conversion
159159
}
@@ -274,7 +274,7 @@ following rules. Such functions:
274274
from the analysis. (The reason for requiring ``noexcept`` in C++ is that a function declared
275275
``noreturn`` could be a wrapper for ``throw``.)
276276

277-
5. May not invoke or access an Objective-C method or property, since ``objc_msgSend()`` calls into
277+
5. May not invoke or access an Objective-C method or property, since ``objc_msgSend()`` calls into
278278
the Objective-C runtime, which may allocate memory or otherwise block.
279279

280280
6. May not access thread-local variables. Typically, thread-local variables are allocated on the

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@ Bug Fixes to C++ Support
571571
- Clang incorrectly considered a class with an anonymous union member to not be
572572
const-default-constructible even if a union member has a default member initializer.
573573
(#GH95854).
574-
- Fixed an assertion failure when evaluating an invalid expression in an array initializer (#GH112140)
574+
- Fixed an assertion failure when evaluating an invalid expression in an array initializer. (#GH112140)
575+
- Fixed an assertion failure in range calculations for conditional throw expressions. (#GH111854)
575576

576577
Bug Fixes to AST Handling
577578
^^^^^^^^^^^^^^^^^^^^^^^^^

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">,

0 commit comments

Comments
 (0)