Skip to content

Commit a2e75de

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:8e14c6c172b122203f46a9ad114d51c74535cbb7 into amd-gfx:6a6bbec15c31
Local branch amd-gfx 6a6bbec Merged main:3f4468faaa9525ad615118675c3c68938f4a8d5f into amd-gfx:4eaa0708702b Remote branch main 8e14c6c [flang] Support -mabi=vec-extabi and -mabi=vec-default on AIX (llvm#113215)
2 parents 6a6bbec + 8e14c6c commit a2e75de

File tree

271 files changed

+11530
-2299
lines changed

Some content is hidden

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

271 files changed

+11530
-2299
lines changed

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

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

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,11 @@ bool CheckNewTypeMismatch(InterpState &S, CodePtr OpPC, const Expr *E,
14511451
<< StorageType << AllocType;
14521452
return false;
14531453
}
1454+
1455+
// Can't activate fields in a union, unless the direct base is the union.
1456+
if (Ptr.inUnion() && !Ptr.isActive() && !Ptr.getBase().getRecord()->isUnion())
1457+
return CheckActive(S, OpPC, Ptr, AK_Construct);
1458+
14541459
return true;
14551460
}
14561461

clang/lib/AST/ByteCode/Pointer.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -653,15 +653,6 @@ class Pointer {
653653
return *reinterpret_cast<T *>(asBlockPointer().Pointee->rawData() + Offset);
654654
}
655655

656-
/// Dereferences a primitive element.
657-
template <typename T> T &elem(unsigned I) const {
658-
assert(I < getNumElems());
659-
assert(isBlockPointer());
660-
assert(asBlockPointer().Pointee);
661-
return reinterpret_cast<T *>(asBlockPointer().Pointee->data() +
662-
sizeof(InitMapPtr))[I];
663-
}
664-
665656
/// Whether this block can be read from at all. This is only true for
666657
/// block pointers that point to a valid location inside that block.
667658
bool isDereferencable() const {

0 commit comments

Comments
 (0)