Skip to content

Commit 83dbc0d

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project
2 parents f74c828 + 58ce3e2 commit 83dbc0d

File tree

506 files changed

+14270
-7449
lines changed

Some content is hidden

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

506 files changed

+14270
-7449
lines changed

.ci/all_requirements.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,6 @@ ml-dtypes==0.5.1 ; python_version < "3.13" \
194194
--hash=sha256:d13755f8e8445b3870114e5b6240facaa7cb0c3361e54beba3e07fa912a6e12b \
195195
--hash=sha256:fd918d4e6a4e0c110e2e05be7a7814d10dc1b95872accbf6512b80a109b71ae1
196196
# via -r mlir/python/requirements.txt
197-
nanobind==2.9.2 \
198-
--hash=sha256:c37957ffd5eac7eda349cff3622ecd32e5ee1244ecc912c99b5bc8188bafd16e \
199-
--hash=sha256:e7608472de99d375759814cab3e2c94aba3f9ec80e62cfef8ced495ca5c27d6e
200-
# via -r mlir/python/requirements.txt
201197
numpy==2.0.2 \
202198
--hash=sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a \
203199
--hash=sha256:11a76c372d1d37437857280aa142086476136a8c0f373b2e648ab2c8f18fb195 \
@@ -299,10 +295,6 @@ pyasn1-modules==0.4.2 \
299295
--hash=sha256:29253a9207ce32b64c3ac6600edc75368f98473906e8fd1043bd6b5b1de2c14a \
300296
--hash=sha256:677091de870a80aae844b1ca6134f54652fa2c8c5a52aa396440ac3106e941e6
301297
# via google-auth
302-
pybind11==2.13.6 \
303-
--hash=sha256:237c41e29157b962835d356b370ededd57594a26d5894a795960f0047cb5caf5 \
304-
--hash=sha256:ba6af10348c12b24e92fa086b39cfba0eff619b61ac77c406167d813b096d39a
305-
# via -r mlir/python/requirements.txt
306298
pyyaml==6.0.1 \
307299
--hash=sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5 \
308300
--hash=sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc \

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ jobs:
255255
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
256256
- name: Install dependencies
257257
run: |
258-
choco install -y ninja
259258
pip install psutil
260259
- name: Install a current LLVM
261260
if: ${{ matrix.mingw != true }}

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "support/Trace.h"
4444
#include "clang/AST/Decl.h"
4545
#include "clang/AST/DeclBase.h"
46+
#include "clang/AST/DeclTemplate.h"
4647
#include "clang/Basic/CharInfo.h"
4748
#include "clang/Basic/LangOptions.h"
4849
#include "clang/Basic/SourceLocation.h"
@@ -1886,7 +1887,15 @@ class CodeCompleteFlow {
18861887
for (auto &Cand : C.first) {
18871888
if (Cand.SemaResult &&
18881889
Cand.SemaResult->Kind == CodeCompletionResult::RK_Declaration) {
1889-
auto ID = clangd::getSymbolID(Cand.SemaResult->getDeclaration());
1890+
const NamedDecl *DeclToLookup = Cand.SemaResult->getDeclaration();
1891+
// For instantiations of members of class templates, the
1892+
// documentation will be stored at the member's original
1893+
// declaration.
1894+
if (const NamedDecl *Adjusted =
1895+
dyn_cast<NamedDecl>(&adjustDeclToTemplate(*DeclToLookup))) {
1896+
DeclToLookup = Adjusted;
1897+
}
1898+
auto ID = clangd::getSymbolID(DeclToLookup);
18901899
if (!ID)
18911900
continue;
18921901
Req.IDs.insert(ID);

clang-tools-extra/clangd/CompileCommands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ llvm::ArrayRef<ArgStripper::Rule> ArgStripper::rulesFor(llvm::StringRef Arg) {
466466
} AliasTable[] = {
467467
#define OPTION(PREFIX, PREFIXED_NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, \
468468
FLAGS, VISIBILITY, PARAM, HELPTEXT, HELPTEXTSFORVARIANTS, \
469-
METAVAR, VALUES) \
469+
METAVAR, VALUES, SUBCOMMANDIDS_OFFSET) \
470470
{DriverID::OPT_##ID, DriverID::OPT_##ALIAS, ALIASARGS},
471471
#include "clang/Driver/Options.inc"
472472
#undef OPTION

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,23 +1154,45 @@ TEST(CompletionTest, CommentsOnMembersFromHeader) {
11541154
/// This is a member function.
11551155
int delta();
11561156
};
1157+
1158+
template <typename T>
1159+
struct beta {
1160+
/// This is a member field inside a template.
1161+
int omega;
1162+
1163+
/// This is a member function inside a template.
1164+
int epsilon();
1165+
};
11571166
)cpp";
11581167

11591168
auto File = testPath("foo.cpp");
11601169
Annotations Test(R"cpp(
11611170
#include "foo.h"
11621171
alpha a;
1163-
int x = a.^
1172+
beta<int> b;
1173+
int x = a.$p1^;
1174+
int y = b.$p2^;
11641175
)cpp");
11651176
runAddDocument(Server, File, Test.code());
11661177
auto CompletionList =
1167-
llvm::cantFail(runCodeComplete(Server, File, Test.point(), {}));
1178+
llvm::cantFail(runCodeComplete(Server, File, Test.point("p1"), {}));
11681179

11691180
EXPECT_THAT(CompletionList.Completions,
11701181
Contains(AllOf(named("gamma"), doc("This is a member field."))));
11711182
EXPECT_THAT(
11721183
CompletionList.Completions,
11731184
Contains(AllOf(named("delta"), doc("This is a member function."))));
1185+
1186+
CompletionList =
1187+
llvm::cantFail(runCodeComplete(Server, File, Test.point("p2"), {}));
1188+
1189+
EXPECT_THAT(CompletionList.Completions,
1190+
Contains(AllOf(named("omega")
1191+
/* FIXME: Doc retrieval does not work yet*/)));
1192+
EXPECT_THAT(
1193+
CompletionList.Completions,
1194+
Contains(AllOf(named("epsilon"),
1195+
doc("This is a member function inside a template."))));
11741196
}
11751197

11761198
TEST(CompletionTest, CommentsOnMembersFromHeaderOverloadBundling) {

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ AST Dumping Potentially Breaking Changes
123123

124124
``__atomic_test_and_set(p, 0)``
125125

126+
- Pretty-printing of templates with inherited (i.e. specified in a previous
127+
redeclaration) default arguments has been fixed.
128+
126129
Clang Frontend Potentially Breaking Changes
127130
-------------------------------------------
128131
- Members of anonymous unions/structs are now injected as ``IndirectFieldDecl``
@@ -442,6 +445,8 @@ Bug Fixes to C++ Support
442445
- Correctly deduce return types in ``decltype`` expressions. (#GH160497) (#GH56652) (#GH116319) (#GH161196)
443446
- Fixed a crash in the pre-C++23 warning for attributes before a lambda declarator (#GH161070).
444447
- Fix a crash when attempting to deduce a deduction guide from a non deducible template template parameter. (#130604)
448+
- Fix for clang incorrectly rejecting the default construction of a union with
449+
nontrivial member when another member has an initializer. (#GH81774)
445450

446451
Bug Fixes to AST Handling
447452
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/DeclTemplate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,6 +3399,11 @@ inline UnsignedOrNone getExpandedPackSize(const NamedDecl *Param) {
33993399
/// for their AssociatedDecl.
34003400
TemplateParameterList *getReplacedTemplateParameterList(const Decl *D);
34013401

3402+
/// If we have a 'templated' declaration for a template, adjust 'D' to
3403+
/// refer to the actual template.
3404+
/// If we have an implicit instantiation, adjust 'D' to refer to template.
3405+
const Decl &adjustDeclToTemplate(const Decl &D);
3406+
34023407
} // namespace clang
34033408

34043409
#endif // LLVM_CLANG_AST_DECLTEMPLATE_H

clang/include/clang/Analysis/FlowSensitive/StorageLocation.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ class RecordStorageLocation final : public StorageLocation {
144144
/// The synthetic field must exist.
145145
StorageLocation &getSyntheticField(llvm::StringRef Name) const {
146146
StorageLocation *Loc = SyntheticFields.lookup(Name);
147+
LLVM_DEBUG({
148+
if (Loc == nullptr) {
149+
llvm::dbgs() << "Couldn't find synthetic field " << Name
150+
<< " on StorageLocation " << this << " of type "
151+
<< getType() << "\n";
152+
llvm::dbgs() << "Existing synthetic fields:\n";
153+
for ([[maybe_unused]] const auto &[Name, Loc] : SyntheticFields) {
154+
llvm::dbgs() << Name << "\n";
155+
}
156+
}
157+
});
147158
assert(Loc != nullptr);
148159
return *Loc;
149160
}

clang/include/clang/Basic/BuiltinsNVPTX.td

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,35 @@ def __nvvm_ff2bf16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)
579579
def __nvvm_ff2bf16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
580580
def __nvvm_ff2bf16x2_rz : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
581581
def __nvvm_ff2bf16x2_rz_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
582+
def __nvvm_ff2bf16x2_rs :
583+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
584+
SM<"100a", [SM_103a]>, PTX87>;
585+
def __nvvm_ff2bf16x2_rs_relu :
586+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
587+
SM<"100a", [SM_103a]>, PTX87>;
588+
def __nvvm_ff2bf16x2_rs_satfinite :
589+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
590+
SM<"100a", [SM_103a]>, PTX87>;
591+
def __nvvm_ff2bf16x2_rs_relu_satfinite :
592+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
593+
SM<"100a", [SM_103a]>, PTX87>;
582594

583595
def __nvvm_ff2f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
584596
def __nvvm_ff2f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
585597
def __nvvm_ff2f16x2_rz : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
586598
def __nvvm_ff2f16x2_rz_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
599+
def __nvvm_ff2f16x2_rs :
600+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
601+
SM<"100a", [SM_103a]>, PTX87>;
602+
def __nvvm_ff2f16x2_rs_relu :
603+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
604+
SM<"100a", [SM_103a]>, PTX87>;
605+
def __nvvm_ff2f16x2_rs_satfinite :
606+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
607+
SM<"100a", [SM_103a]>, PTX87>;
608+
def __nvvm_ff2f16x2_rs_relu_satfinite :
609+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
610+
SM<"100a", [SM_103a]>, PTX87>;
587611

588612
def __nvvm_f2bf16_rn : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
589613
def __nvvm_f2bf16_rn_relu : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
@@ -616,6 +640,19 @@ def __nvvm_e4m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
616640
def __nvvm_e5m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
617641
def __nvvm_e5m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
618642

643+
def __nvvm_f32x4_to_e4m3x4_rs_satfinite :
644+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
645+
SM<"100a", [SM_103a]>, PTX87>;
646+
def __nvvm_f32x4_to_e4m3x4_rs_relu_satfinite :
647+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
648+
SM<"100a", [SM_103a]>, PTX87>;
649+
def __nvvm_f32x4_to_e5m2x4_rs_satfinite :
650+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
651+
SM<"100a", [SM_103a]>, PTX87>;
652+
def __nvvm_f32x4_to_e5m2x4_rs_relu_satfinite :
653+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
654+
SM<"100a", [SM_103a]>, PTX87>;
655+
619656
def __nvvm_ff_to_e2m3x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
620657
def __nvvm_ff_to_e2m3x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
621658
def __nvvm_ff_to_e3m2x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
@@ -626,12 +663,32 @@ def __nvvm_e2m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
626663
def __nvvm_e3m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
627664
def __nvvm_e3m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
628665

666+
def __nvvm_f32x4_to_e2m3x4_rs_satfinite :
667+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
668+
SM<"100a", [SM_103a]>, PTX87>;
669+
def __nvvm_f32x4_to_e2m3x4_rs_relu_satfinite :
670+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
671+
SM<"100a", [SM_103a]>, PTX87>;
672+
def __nvvm_f32x4_to_e3m2x4_rs_satfinite :
673+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
674+
SM<"100a", [SM_103a]>, PTX87>;
675+
def __nvvm_f32x4_to_e3m2x4_rs_relu_satfinite :
676+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
677+
SM<"100a", [SM_103a]>, PTX87>;
678+
629679
def __nvvm_ff_to_e2m1x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
630680
def __nvvm_ff_to_e2m1x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
631681

632682
def __nvvm_e2m1x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
633683
def __nvvm_e2m1x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
634684

685+
def __nvvm_f32x4_to_e2m1x4_rs_satfinite :
686+
NVPTXBuiltinSMAndPTX<"short(_Vector<4, float>, uint32_t)",
687+
SM<"100a", [SM_103a]>, PTX87>;
688+
def __nvvm_f32x4_to_e2m1x4_rs_relu_satfinite :
689+
NVPTXBuiltinSMAndPTX<"short(_Vector<4, float>, uint32_t)",
690+
SM<"100a", [SM_103a]>, PTX87>;
691+
635692
def __nvvm_ff_to_ue8m0x2_rz : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
636693
def __nvvm_ff_to_ue8m0x2_rz_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
637694
def __nvvm_ff_to_ue8m0x2_rp : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,28 +2409,36 @@ let Features = "avx512f", Attributes = [NoThrow, Const, RequiredVectorWidth<512>
24092409
def psraq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>)">;
24102410
def psrld512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<4, int>)">;
24112411
def psrlq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>)">;
2412+
}
2413+
2414+
let Features = "avx512f",
2415+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
24122416
def pternlogd512_mask : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;
24132417
def pternlogd512_maskz : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;
24142418
def pternlogq512_mask : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Vector<8, long long int>, _Constant int, unsigned char)">;
24152419
def pternlogq512_maskz : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Vector<8, long long int>, _Constant int, unsigned char)">;
24162420
}
24172421

2418-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
2422+
let Features = "avx512vl",
2423+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
24192424
def pternlogd128_mask : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>, _Constant int, unsigned char)">;
24202425
def pternlogd128_maskz : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>, _Constant int, unsigned char)">;
24212426
}
24222427

2423-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
2428+
let Features = "avx512vl",
2429+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
24242430
def pternlogd256_mask : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>, _Constant int, unsigned char)">;
24252431
def pternlogd256_maskz : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>, _Constant int, unsigned char)">;
24262432
}
24272433

2428-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
2434+
let Features = "avx512vl",
2435+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
24292436
def pternlogq128_mask : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>, _Vector<2, long long int>, _Constant int, unsigned char)">;
24302437
def pternlogq128_maskz : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>, _Vector<2, long long int>, _Constant int, unsigned char)">;
24312438
}
24322439

2433-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
2440+
let Features = "avx512vl",
2441+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
24342442
def pternlogq256_mask : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Vector<4, long long int>, _Constant int, unsigned char)">;
24352443
def pternlogq256_maskz : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Vector<4, long long int>, _Constant int, unsigned char)">;
24362444
}

0 commit comments

Comments
 (0)