Skip to content

Commit c1723a6

Browse files
committed
merge main into amd-staging
5 mlir tests xfailed due to flang-new entry point spellings
2 parents 228cef1 + 60dc450 commit c1723a6

File tree

532 files changed

+13560
-5054
lines changed

Some content is hidden

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

532 files changed

+13560
-5054
lines changed

.ci/metrics/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"https://influx-prod-13-prod-us-east-0.grafana.net/api/v1/push/influx/write"
1313
)
1414
GITHUB_PROJECT = "llvm/llvm-project"
15-
WORKFLOWS_TO_TRACK = ["Check code formatting", "LLVM Premerge Checks"]
15+
WORKFLOWS_TO_TRACK = ["LLVM Premerge Checks"]
1616
SCRAPE_INTERVAL_SECONDS = 5 * 60
1717

1818

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static void ignoreTypeLocClasses(
342342
Loc = Loc.getNextTypeLoc();
343343
}
344344

345-
static bool isMutliLevelPointerToTypeLocClasses(
345+
static bool isMultiLevelPointerToTypeLocClasses(
346346
TypeLoc Loc,
347347
std::initializer_list<TypeLoc::TypeLocClass> const &LocClasses) {
348348
ignoreTypeLocClasses(Loc, {TypeLoc::Paren, TypeLoc::Qualified});
@@ -424,7 +424,7 @@ void UseAutoCheck::replaceExpr(
424424

425425
auto Diag = diag(Range.getBegin(), Message);
426426

427-
bool ShouldReplenishVariableName = isMutliLevelPointerToTypeLocClasses(
427+
bool ShouldReplenishVariableName = isMultiLevelPointerToTypeLocClasses(
428428
TSI->getTypeLoc(), {TypeLoc::FunctionProto, TypeLoc::ConstantArray});
429429

430430
// Space after 'auto' to handle cases where the '*' in the pointer type is

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ Changes in existing checks
351351
<clang-tidy/checks/performance/move-const-arg>` check to fix a crash when
352352
an argument type is declared but not defined.
353353

354-
- Improved :doc:`performance-unnecessary-copy-initialization`
355-
<clang-tidy/checks/performance/unnecessary-copy-initialization> check
354+
- Improved :doc:`performance-unnecessary-copy-initialization
355+
<clang-tidy/checks/performance/unnecessary-copy-initialization>` check
356356
to consider static member functions the same way as free functions.
357357

358358
- Improved :doc:`readability-container-contains

clang/docs/ReleaseNotes.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,23 @@ X86 Support
11021102
Arm and AArch64 Support
11031103
^^^^^^^^^^^^^^^^^^^^^^^
11041104

1105+
- Implementation of SVE2.1 and SME2.1 in accordance with the Arm C Language
1106+
Extensions (ACLE) is now available.
1107+
11051108
- In the ARM Target, the frame pointer (FP) of a leaf function can be retained
11061109
by using the ``-fno-omit-frame-pointer`` option. If you want to eliminate the FP
11071110
in leaf functions after enabling ``-fno-omit-frame-pointer``, you can do so by adding
11081111
the ``-momit-leaf-frame-pointer`` option.
11091112

1113+
- SME keyword attributes which apply to function types are now represented in the
1114+
mangling of the type. This means that ``void foo(void (*f)() __arm_streaming);``
1115+
now has a different mangling from ``void foo(void (*f)());``.
1116+
1117+
- The ``__arm_agnostic`` keyword attribute was added to let users describe
1118+
a function that preserves SME state enabled by PSTATE.ZA without having to share
1119+
this state with its callers and without making the assumption that this state
1120+
exists.
1121+
11101122
- Support has been added for the following processors (-mcpu identifiers in parenthesis):
11111123

11121124
For AArch64:

clang/include/clang/AST/Decl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4285,6 +4285,14 @@ class RecordDecl : public TagDecl {
42854285
RecordDeclBits.HasNonTrivialToPrimitiveCopyCUnion = V;
42864286
}
42874287

4288+
bool hasUninitializedExplicitInitFields() const {
4289+
return RecordDeclBits.HasUninitializedExplicitInitFields;
4290+
}
4291+
4292+
void setHasUninitializedExplicitInitFields(bool V) {
4293+
RecordDeclBits.HasUninitializedExplicitInitFields = V;
4294+
}
4295+
42884296
/// Determine whether this class can be passed in registers. In C++ mode,
42894297
/// it must have at least one trivial, non-deleted copy or move constructor.
42904298
/// FIXME: This should be set as part of completeDefinition.

clang/include/clang/AST/DeclBase.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,9 @@ class DeclContext {
14461446
/// hasLazyLocalLexicalLookups, hasLazyExternalLexicalLookups
14471447
friend class ASTWriter;
14481448

1449+
protected:
1450+
enum { NumOdrHashBits = 25 };
1451+
14491452
// We use uint64_t in the bit-fields below since some bit-fields
14501453
// cross the unsigned boundary and this breaks the packing.
14511454

@@ -1667,6 +1670,14 @@ class DeclContext {
16671670
LLVM_PREFERRED_TYPE(bool)
16681671
uint64_t HasNonTrivialToPrimitiveCopyCUnion : 1;
16691672

1673+
/// True if any field is marked as requiring explicit initialization with
1674+
/// [[clang::require_explicit_initialization]].
1675+
/// In C++, this is also set for types without a user-provided default
1676+
/// constructor, and is propagated from any base classes and/or member
1677+
/// variables whose types are aggregates.
1678+
LLVM_PREFERRED_TYPE(bool)
1679+
uint64_t HasUninitializedExplicitInitFields : 1;
1680+
16701681
/// Indicates whether this struct is destroyed in the callee.
16711682
LLVM_PREFERRED_TYPE(bool)
16721683
uint64_t ParamDestroyedInCallee : 1;
@@ -1681,7 +1692,7 @@ class DeclContext {
16811692

16821693
/// True if a valid hash is stored in ODRHash. This should shave off some
16831694
/// extra storage and prevent CXXRecordDecl to store unused bits.
1684-
uint64_t ODRHash : 26;
1695+
uint64_t ODRHash : NumOdrHashBits;
16851696
};
16861697

16871698
/// Number of inherited and non-inherited bits in RecordDeclBitfields.

clang/include/clang/Basic/Attr.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,13 @@ def Leaf : InheritableAttr {
19021902
let SimpleHandler = 1;
19031903
}
19041904

1905+
def ExplicitInit : InheritableAttr {
1906+
let Spellings = [Clang<"require_explicit_initialization">];
1907+
let Subjects = SubjectList<[Field], ErrorDiag>;
1908+
let Documentation = [ExplicitInitDocs];
1909+
let SimpleHandler = 1;
1910+
}
1911+
19051912
def LifetimeBound : DeclOrTypeAttr {
19061913
let Spellings = [Clang<"lifetimebound", 0>];
19071914
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,6 +1684,55 @@ is not specified.
16841684
}];
16851685
}
16861686

1687+
def ExplicitInitDocs : Documentation {
1688+
let Category = DocCatField;
1689+
let Content = [{
1690+
The ``clang::require_explicit_initialization`` attribute indicates that a
1691+
field of an aggregate must be initialized explicitly by the user when an object
1692+
of the aggregate type is constructed. The attribute supports both C and C++,
1693+
but its usage is invalid on non-aggregates.
1694+
1695+
Note that this attribute is *not* a memory safety feature, and is *not* intended
1696+
to guard against use of uninitialized memory.
1697+
1698+
Rather, it is intended for use in "parameter-objects", used to simulate,
1699+
for example, the passing of named parameters.
1700+
The attribute generates a warning when explicit initializers for such
1701+
variables are not provided (this occurs regardless of whether any in-class field
1702+
initializers exist):
1703+
1704+
.. code-block:: c++
1705+
1706+
struct Buffer {
1707+
void *address [[clang::require_explicit_initialization]];
1708+
size_t length [[clang::require_explicit_initialization]] = 0;
1709+
};
1710+
1711+
struct ArrayIOParams {
1712+
size_t count [[clang::require_explicit_initialization]];
1713+
size_t element_size [[clang::require_explicit_initialization]];
1714+
int flags = 0;
1715+
};
1716+
1717+
size_t ReadArray(FILE *file, struct Buffer buffer,
1718+
struct ArrayIOParams params);
1719+
1720+
int main() {
1721+
unsigned int buf[512];
1722+
ReadArray(stdin, {
1723+
buf
1724+
// warning: field 'length' is not explicitly initialized
1725+
}, {
1726+
.count = sizeof(buf) / sizeof(*buf),
1727+
// warning: field 'element_size' is not explicitly initialized
1728+
// (Note that a missing initializer for 'flags' is not diagnosed, because
1729+
// the field is not marked as requiring explicit initialization.)
1730+
});
1731+
}
1732+
1733+
}];
1734+
}
1735+
16871736
def NoUniqueAddressDocs : Documentation {
16881737
let Category = DocCatField;
16891738
let Content = [{

clang/include/clang/Basic/Builtins.td

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3347,10 +3347,12 @@ def VFork : LibBuiltin<"unistd.h"> {
33473347
}
33483348

33493349
// POSIX pthread.h
3350-
// FIXME: This should be a GNULibBuiltin, but it's currently missing the prototype.
33513350

3352-
def PthreadCreate : CustomEntry {
3353-
let Entry = "LIBBUILTIN(pthread_create, \"\", \"fC<2,3>\", PTHREAD_H, ALL_GNU_LANGUAGES)";
3351+
def PthreadCreate : GNULibBuiltin<"pthread.h"> {
3352+
let Spellings = ["pthread_create"];
3353+
let Attributes = [FunctionWithoutBuiltinPrefix, Callback<[2, 3]>];
3354+
// Note that we don't have an expressable prototype so we leave it empty.
3355+
let Prototype = "";
33543356
}
33553357

33563358
def SigSetJmp : LibBuiltin<"setjmp.h"> {

clang/include/clang/Basic/BuiltinsBase.td

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ class IndexedAttribute<string baseMangling, int I> : Attribute<baseMangling> {
1717
int Index = I;
1818
}
1919

20+
class MultiIndexAttribute<string baseMangling, list<int> Is>
21+
: Attribute<baseMangling> {
22+
list<int> Indices = Is;
23+
}
24+
2025
// Standard Attributes
2126
// -------------------
2227
def NoReturn : Attribute<"r">;
@@ -77,6 +82,10 @@ def Constexpr : Attribute<"E">;
7782
// Builtin is immediate and must be constant evaluated. Implies Constexpr, and will only be supported in C++20 mode.
7883
def Consteval : Attribute<"EG">;
7984

85+
// Callback behavior: the first index argument is called with the arguments
86+
// indicated by the remaining indices.
87+
class Callback<list<int> ArgIndices> : MultiIndexAttribute<"C", ArgIndices>;
88+
8089
// Builtin kinds
8190
// =============
8291

@@ -92,10 +101,6 @@ class Builtin {
92101
bit EnableOpenCLLong = 0;
93102
}
94103

95-
class CustomEntry {
96-
string Entry;
97-
}
98-
99104
class AtomicBuiltin : Builtin;
100105

101106
class LibBuiltin<string header, string languages = "ALL_LANGUAGES"> : Builtin {

0 commit comments

Comments
 (0)