Skip to content

Commit 8bbad6c

Browse files
authored
Merge branch 'main' into sve_adjust
2 parents fbef24c + 024dd56 commit 8bbad6c

File tree

185 files changed

+56836
-28351
lines changed

Some content is hidden

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

185 files changed

+56836
-28351
lines changed

clang-tools-extra/clang-doc/Generators.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,11 @@ void Generator::addInfoToIndex(Index &Idx, const doc::Info *Info) {
9797

9898
// This anchor is used to force the linker to link in the generated object file
9999
// and thus register the generators.
100-
static int LLVM_ATTRIBUTE_UNUSED YAMLGeneratorAnchorDest =
101-
YAMLGeneratorAnchorSource;
102-
static int LLVM_ATTRIBUTE_UNUSED MDGeneratorAnchorDest =
103-
MDGeneratorAnchorSource;
104-
static int LLVM_ATTRIBUTE_UNUSED HTMLGeneratorAnchorDest =
105-
HTMLGeneratorAnchorSource;
106-
static int LLVM_ATTRIBUTE_UNUSED MHTMLGeneratorAnchorDest =
100+
[[maybe_unused]] static int YAMLGeneratorAnchorDest = YAMLGeneratorAnchorSource;
101+
[[maybe_unused]] static int MDGeneratorAnchorDest = MDGeneratorAnchorSource;
102+
[[maybe_unused]] static int HTMLGeneratorAnchorDest = HTMLGeneratorAnchorSource;
103+
[[maybe_unused]] static int MHTMLGeneratorAnchorDest =
107104
MHTMLGeneratorAnchorSource;
108-
static int LLVM_ATTRIBUTE_UNUSED JSONGeneratorAnchorDest =
109-
JSONGeneratorAnchorSource;
105+
[[maybe_unused]] static int JSONGeneratorAnchorDest = JSONGeneratorAnchorSource;
110106
} // namespace doc
111107
} // namespace clang

clang-tools-extra/clang-tidy/ClangTidyForceLinker.h

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,132 +16,131 @@ namespace clang::tidy {
1616

1717
// This anchor is used to force the linker to link the AbseilModule.
1818
extern volatile int AbseilModuleAnchorSource;
19-
static int LLVM_ATTRIBUTE_UNUSED AbseilModuleAnchorDestination =
19+
[[maybe_unused]] static int AbseilModuleAnchorDestination =
2020
AbseilModuleAnchorSource;
2121

2222
// This anchor is used to force the linker to link the AlteraModule.
2323
extern volatile int AlteraModuleAnchorSource;
24-
static int LLVM_ATTRIBUTE_UNUSED AlteraModuleAnchorDestination =
24+
[[maybe_unused]] static int AlteraModuleAnchorDestination =
2525
AlteraModuleAnchorSource;
2626

2727
// This anchor is used to force the linker to link the AndroidModule.
2828
extern volatile int AndroidModuleAnchorSource;
29-
static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination =
29+
[[maybe_unused]] static int AndroidModuleAnchorDestination =
3030
AndroidModuleAnchorSource;
3131

3232
// This anchor is used to force the linker to link the BoostModule.
3333
extern volatile int BoostModuleAnchorSource;
34-
static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination =
34+
[[maybe_unused]] static int BoostModuleAnchorDestination =
3535
BoostModuleAnchorSource;
3636

3737
// This anchor is used to force the linker to link the BugproneModule.
3838
extern volatile int BugproneModuleAnchorSource;
39-
static int LLVM_ATTRIBUTE_UNUSED BugproneModuleAnchorDestination =
39+
[[maybe_unused]] static int BugproneModuleAnchorDestination =
4040
BugproneModuleAnchorSource;
4141

4242
// This anchor is used to force the linker to link the CERTModule.
4343
extern volatile int CERTModuleAnchorSource;
44-
static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination =
44+
[[maybe_unused]] static int CERTModuleAnchorDestination =
4545
CERTModuleAnchorSource;
4646

4747
// This anchor is used to force the linker to link the ConcurrencyModule.
4848
extern volatile int ConcurrencyModuleAnchorSource;
49-
static int LLVM_ATTRIBUTE_UNUSED ConcurrencyModuleAnchorDestination =
49+
[[maybe_unused]] static int ConcurrencyModuleAnchorDestination =
5050
ConcurrencyModuleAnchorSource;
5151

5252
// This anchor is used to force the linker to link the CppCoreGuidelinesModule.
5353
extern volatile int CppCoreGuidelinesModuleAnchorSource;
54-
static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination =
54+
[[maybe_unused]] static int CppCoreGuidelinesModuleAnchorDestination =
5555
CppCoreGuidelinesModuleAnchorSource;
5656

5757
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
5858
// This anchor is used to force the linker to link the CustomModule.
5959
extern volatile int CustomModuleAnchorSource;
60-
static int LLVM_ATTRIBUTE_UNUSED CustomModuleAnchorDestination =
60+
[[maybe_unused]] static int CustomModuleAnchorDestination =
6161
CustomModuleAnchorSource;
6262
#endif
6363

6464
// This anchor is used to force the linker to link the DarwinModule.
6565
extern volatile int DarwinModuleAnchorSource;
66-
static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination =
66+
[[maybe_unused]] static int DarwinModuleAnchorDestination =
6767
DarwinModuleAnchorSource;
6868

6969
// This anchor is used to force the linker to link the FuchsiaModule.
7070
extern volatile int FuchsiaModuleAnchorSource;
71-
static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination =
71+
[[maybe_unused]] static int FuchsiaModuleAnchorDestination =
7272
FuchsiaModuleAnchorSource;
7373

7474
// This anchor is used to force the linker to link the GoogleModule.
7575
extern volatile int GoogleModuleAnchorSource;
76-
static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
76+
[[maybe_unused]] static int GoogleModuleAnchorDestination =
7777
GoogleModuleAnchorSource;
7878

7979
// This anchor is used to force the linker to link the HICPPModule.
8080
extern volatile int HICPPModuleAnchorSource;
81-
static int LLVM_ATTRIBUTE_UNUSED HICPPModuleAnchorDestination =
81+
[[maybe_unused]] static int HICPPModuleAnchorDestination =
8282
HICPPModuleAnchorSource;
8383

8484
// This anchor is used to force the linker to link the LinuxKernelModule.
8585
extern volatile int LinuxKernelModuleAnchorSource;
86-
static int LLVM_ATTRIBUTE_UNUSED LinuxKernelModuleAnchorDestination =
86+
[[maybe_unused]] static int LinuxKernelModuleAnchorDestination =
8787
LinuxKernelModuleAnchorSource;
8888

8989
// This anchor is used to force the linker to link the LLVMModule.
9090
extern volatile int LLVMModuleAnchorSource;
91-
static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
91+
[[maybe_unused]] static int LLVMModuleAnchorDestination =
9292
LLVMModuleAnchorSource;
9393

9494
// This anchor is used to force the linker to link the LLVMLibcModule.
9595
extern volatile int LLVMLibcModuleAnchorSource;
96-
static int LLVM_ATTRIBUTE_UNUSED LLVMLibcModuleAnchorDestination =
96+
[[maybe_unused]] static int LLVMLibcModuleAnchorDestination =
9797
LLVMLibcModuleAnchorSource;
9898

9999
// This anchor is used to force the linker to link the MiscModule.
100100
extern volatile int MiscModuleAnchorSource;
101-
static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
101+
[[maybe_unused]] static int MiscModuleAnchorDestination =
102102
MiscModuleAnchorSource;
103103

104104
// This anchor is used to force the linker to link the ModernizeModule.
105105
extern volatile int ModernizeModuleAnchorSource;
106-
static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
106+
[[maybe_unused]] static int ModernizeModuleAnchorDestination =
107107
ModernizeModuleAnchorSource;
108108

109109
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER && \
110110
!defined(CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS)
111111
// This anchor is used to force the linker to link the MPIModule.
112112
extern volatile int MPIModuleAnchorSource;
113-
static int LLVM_ATTRIBUTE_UNUSED MPIModuleAnchorDestination =
114-
MPIModuleAnchorSource;
113+
[[maybe_unused]] static int MPIModuleAnchorDestination = MPIModuleAnchorSource;
115114
#endif
116115

117116
// This anchor is used to force the linker to link the ObjCModule.
118117
extern volatile int ObjCModuleAnchorSource;
119-
static int LLVM_ATTRIBUTE_UNUSED ObjCModuleAnchorDestination =
118+
[[maybe_unused]] static int ObjCModuleAnchorDestination =
120119
ObjCModuleAnchorSource;
121120

122121
// This anchor is used to force the linker to link the OpenMPModule.
123122
extern volatile int OpenMPModuleAnchorSource;
124-
static int LLVM_ATTRIBUTE_UNUSED OpenMPModuleAnchorDestination =
123+
[[maybe_unused]] static int OpenMPModuleAnchorDestination =
125124
OpenMPModuleAnchorSource;
126125

127126
// This anchor is used to force the linker to link the PerformanceModule.
128127
extern volatile int PerformanceModuleAnchorSource;
129-
static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination =
128+
[[maybe_unused]] static int PerformanceModuleAnchorDestination =
130129
PerformanceModuleAnchorSource;
131130

132131
// This anchor is used to force the linker to link the PortabilityModule.
133132
extern volatile int PortabilityModuleAnchorSource;
134-
static int LLVM_ATTRIBUTE_UNUSED PortabilityModuleAnchorDestination =
133+
[[maybe_unused]] static int PortabilityModuleAnchorDestination =
135134
PortabilityModuleAnchorSource;
136135

137136
// This anchor is used to force the linker to link the ReadabilityModule.
138137
extern volatile int ReadabilityModuleAnchorSource;
139-
static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
138+
[[maybe_unused]] static int ReadabilityModuleAnchorDestination =
140139
ReadabilityModuleAnchorSource;
141140

142141
// This anchor is used to force the linker to link the ZirconModule.
143142
extern volatile int ZirconModuleAnchorSource;
144-
static int LLVM_ATTRIBUTE_UNUSED ZirconModuleAnchorDestination =
143+
[[maybe_unused]] static int ZirconModuleAnchorDestination =
145144
ZirconModuleAnchorSource;
146145

147146
} // namespace clang::tidy

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace clang {
5050
namespace clangd {
5151
namespace {
5252

53-
LLVM_ATTRIBUTE_UNUSED std::string nodeToString(const DynTypedNode &N) {
53+
[[maybe_unused]] std::string nodeToString(const DynTypedNode &N) {
5454
std::string S = std::string(N.getNodeKind().asStringRef());
5555
{
5656
llvm::raw_string_ostream OS(S);

clang-tools-extra/clangd/unittests/FileDistanceTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ TEST(FileDistanceTests, BadSource) {
5858
}
5959

6060
// Force the unittest URI scheme to be linked,
61-
static int LLVM_ATTRIBUTE_UNUSED UseUnittestScheme = UnittestSchemeAnchorSource;
61+
[[maybe_unused]] static int UseUnittestScheme = UnittestSchemeAnchorSource;
6262

6363
TEST(FileDistanceTests, URI) {
6464
FileDistanceOptions Opts;

clang-tools-extra/clangd/unittests/QualityTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace clang {
3333
namespace clangd {
3434

3535
// Force the unittest URI scheme to be linked,
36-
static int LLVM_ATTRIBUTE_UNUSED UnittestSchemeAnchorDest =
36+
[[maybe_unused]] static int UnittestSchemeAnchorDest =
3737
UnittestSchemeAnchorSource;
3838

3939
namespace {

clang-tools-extra/clangd/unittests/URITests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace clang {
1616
namespace clangd {
1717

1818
// Force the unittest URI scheme to be linked,
19-
static int LLVM_ATTRIBUTE_UNUSED UnittestSchemeAnchorDest =
19+
[[maybe_unused]] static int UnittestSchemeAnchorDest =
2020
UnittestSchemeAnchorSource;
2121

2222
namespace {

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ Non-comprehensive list of changes in this release
271271
allocation functions with a token ID can be enabled via the
272272
``-fsanitize=alloc-token`` flag.
273273

274+
- Clang now rejects the invalid use of ``constexpr`` with ``auto`` and an explicit type in C. (#GH163090)
275+
274276
New Compiler Flags
275277
------------------
276278
- New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).

clang/include/clang/Basic/Attr.td

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,23 @@ def HIPManaged : InheritableAttr {
15721572
let Documentation = [HIPManagedAttrDocs];
15731573
}
15741574

1575+
def CUDAClusterDims : InheritableAttr {
1576+
let Spellings = [GNU<"cluster_dims">];
1577+
let Args = [ExprArgument<"X">, ExprArgument<"Y", /*opt=*/1>, ExprArgument<"Z", /*opt=*/1>];
1578+
let Subjects = SubjectList<[ObjCMethod, FunctionLike]>;
1579+
let LangOpts = [CUDA];
1580+
let Documentation = [CUDAClusterDimsAttrDoc];
1581+
}
1582+
1583+
def CUDANoCluster : InheritableAttr {
1584+
let Spellings = [GNU<"no_cluster">];
1585+
let Subjects = SubjectList<[ObjCMethod, FunctionLike]>;
1586+
let LangOpts = [CUDA];
1587+
let Documentation = [CUDANoClusterAttrDoc];
1588+
}
1589+
1590+
def : MutualExclusions<[CUDAClusterDims, CUDANoCluster]>;
1591+
15751592
def CUDAInvalidTarget : InheritableAttr {
15761593
let Spellings = [];
15771594
let Subjects = SubjectList<[Function]>;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7545,6 +7545,45 @@ A managed variable can be accessed in both device and host code.
75457545
}];
75467546
}
75477547

7548+
def CUDAClusterDimsAttrDoc : Documentation {
7549+
let Category = DocCatDecl;
7550+
let Content = [{
7551+
In CUDA/HIP programming, the ``cluster_dims`` attribute, conventionally exposed as the
7552+
``__cluster_dims__`` macro, can be applied to a kernel function to set the dimensions of a
7553+
thread block cluster, which is an optional level of hierarchy and made up of thread blocks.
7554+
``__cluster_dims__`` defines the cluster size as ``(X, Y, Z)``, where each value is the number
7555+
of thread blocks in that dimension. The ``cluster_dims`` and `no_cluster`` attributes are
7556+
mutually exclusive.
7557+
7558+
.. code::
7559+
7560+
__global__ __cluster_dims__(2, 1, 1) void kernel(...) {
7561+
...
7562+
}
7563+
7564+
}];
7565+
}
7566+
7567+
def CUDANoClusterAttrDoc : Documentation {
7568+
let Category = DocCatDecl;
7569+
let Content = [{
7570+
In CUDA/HIP programming, a kernel function can still be launched with the cluster feature enabled
7571+
at runtime, even without being annotated with ``__cluster_dims__``. The LLVM/Clang-exclusive
7572+
``no_cluster`` attribute, conventionally exposed as the ``__no_cluster__`` macro, can be applied to
7573+
a kernel function to explicitly indicate that the cluster feature will not be enabled either at
7574+
compile time or at kernel launch time. This allows the compiler to apply certain optimizations
7575+
without assuming that clustering could be enabled at runtime. It is undefined behavior to launch a
7576+
kernel annotated with ``__no_cluster__`` if the cluster feature is enabled at runtime.
7577+
The ``cluster_dims`` and ``no_cluster`` attributes are mutually exclusive.
7578+
7579+
.. code::
7580+
7581+
__global__ __no_cluster__ void kernel(...) {
7582+
...
7583+
}
7584+
}];
7585+
}
7586+
75487587
def LifetimeOwnerDocs : Documentation {
75497588
let Category = DocCatDecl;
75507589
let Content = [{

clang/include/clang/Basic/Builtins.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4957,6 +4957,18 @@ def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> {
49574957
let Prototype = "uint32_t(uint32_t)";
49584958
}
49594959

4960+
def HLSLResourceGetDimensionsX : LangBuiltin<"HLSL_LANG"> {
4961+
let Spellings = ["__builtin_hlsl_resource_getdimensions_x"];
4962+
let Attributes = [NoThrow];
4963+
let Prototype = "void(...)";
4964+
}
4965+
4966+
def HLSLResourceGetStride : LangBuiltin<"HLSL_LANG"> {
4967+
let Spellings = ["__builtin_hlsl_resource_getstride"];
4968+
let Attributes = [NoThrow];
4969+
let Prototype = "void(...)";
4970+
}
4971+
49604972
def HLSLAll : LangBuiltin<"HLSL_LANG"> {
49614973
let Spellings = ["__builtin_hlsl_all"];
49624974
let Attributes = [NoThrow, Const];

0 commit comments

Comments
 (0)