Skip to content

Commit 3fa0eb0

Browse files
iclsrcjsji
authored andcommitted
Merge from 'main' to 'sycl-web' (87 commits)
CONFLICT (content): Merge conflict in clang/lib/Driver/ToolChains/Clang.cpp
2 parents 39e9bb5 + 839b91c commit 3fa0eb0

File tree

361 files changed

+10412
-5395
lines changed

Some content is hidden

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

361 files changed

+10412
-5395
lines changed

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/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/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/Basic/BuiltinsNVPTX.td

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,35 @@ def __nvvm_ff2bf16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)
590590
def __nvvm_ff2bf16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
591591
def __nvvm_ff2bf16x2_rz : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
592592
def __nvvm_ff2bf16x2_rz_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
593+
def __nvvm_ff2bf16x2_rs :
594+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
595+
SM<"100a", [SM_103a]>, PTX87>;
596+
def __nvvm_ff2bf16x2_rs_relu :
597+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
598+
SM<"100a", [SM_103a]>, PTX87>;
599+
def __nvvm_ff2bf16x2_rs_satfinite :
600+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
601+
SM<"100a", [SM_103a]>, PTX87>;
602+
def __nvvm_ff2bf16x2_rs_relu_satfinite :
603+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
604+
SM<"100a", [SM_103a]>, PTX87>;
593605

594606
def __nvvm_ff2f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
595607
def __nvvm_ff2f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
596608
def __nvvm_ff2f16x2_rz : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
597609
def __nvvm_ff2f16x2_rz_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
610+
def __nvvm_ff2f16x2_rs :
611+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
612+
SM<"100a", [SM_103a]>, PTX87>;
613+
def __nvvm_ff2f16x2_rs_relu :
614+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
615+
SM<"100a", [SM_103a]>, PTX87>;
616+
def __nvvm_ff2f16x2_rs_satfinite :
617+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
618+
SM<"100a", [SM_103a]>, PTX87>;
619+
def __nvvm_ff2f16x2_rs_relu_satfinite :
620+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
621+
SM<"100a", [SM_103a]>, PTX87>;
598622

599623
def __nvvm_f2bf16_rn : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
600624
def __nvvm_f2bf16_rn_relu : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
@@ -627,6 +651,19 @@ def __nvvm_e4m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
627651
def __nvvm_e5m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
628652
def __nvvm_e5m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
629653

654+
def __nvvm_f32x4_to_e4m3x4_rs_satfinite :
655+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
656+
SM<"100a", [SM_103a]>, PTX87>;
657+
def __nvvm_f32x4_to_e4m3x4_rs_relu_satfinite :
658+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
659+
SM<"100a", [SM_103a]>, PTX87>;
660+
def __nvvm_f32x4_to_e5m2x4_rs_satfinite :
661+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
662+
SM<"100a", [SM_103a]>, PTX87>;
663+
def __nvvm_f32x4_to_e5m2x4_rs_relu_satfinite :
664+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
665+
SM<"100a", [SM_103a]>, PTX87>;
666+
630667
def __nvvm_ff_to_e2m3x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
631668
def __nvvm_ff_to_e2m3x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
632669
def __nvvm_ff_to_e3m2x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
@@ -637,12 +674,32 @@ def __nvvm_e2m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
637674
def __nvvm_e3m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
638675
def __nvvm_e3m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
639676

677+
def __nvvm_f32x4_to_e2m3x4_rs_satfinite :
678+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
679+
SM<"100a", [SM_103a]>, PTX87>;
680+
def __nvvm_f32x4_to_e2m3x4_rs_relu_satfinite :
681+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
682+
SM<"100a", [SM_103a]>, PTX87>;
683+
def __nvvm_f32x4_to_e3m2x4_rs_satfinite :
684+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
685+
SM<"100a", [SM_103a]>, PTX87>;
686+
def __nvvm_f32x4_to_e3m2x4_rs_relu_satfinite :
687+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
688+
SM<"100a", [SM_103a]>, PTX87>;
689+
640690
def __nvvm_ff_to_e2m1x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
641691
def __nvvm_ff_to_e2m1x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
642692

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

696+
def __nvvm_f32x4_to_e2m1x4_rs_satfinite :
697+
NVPTXBuiltinSMAndPTX<"short(_Vector<4, float>, uint32_t)",
698+
SM<"100a", [SM_103a]>, PTX87>;
699+
def __nvvm_f32x4_to_e2m1x4_rs_relu_satfinite :
700+
NVPTXBuiltinSMAndPTX<"short(_Vector<4, float>, uint32_t)",
701+
SM<"100a", [SM_103a]>, PTX87>;
702+
646703
def __nvvm_ff_to_ue8m0x2_rz : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
647704
def __nvvm_ff_to_ue8m0x2_rz_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
648705
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
}

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,9 @@ def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
767767
"option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored">,
768768
InGroup<OptionIgnored>;
769769

770+
def err_drv_profile_instrument_use_path_with_no_kind : Error<
771+
"option '-fprofile-instrument-use-path=' requires -fprofile-instrument-use=<kind>">;
772+
770773
def note_drv_verify_prefix_spelling : Note<
771774
"-verify prefixes must start with a letter and contain only alphanumeric"
772775
" characters, hyphens, and underscores">;

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ LANGOPT(HLSLStrictAvailability, 1, 0, NotCompatible,
245245
LANGOPT(HLSLSpvUseUnknownImageFormat, 1, 0, NotCompatible, "For storage images and texel buffers, sets the default format to 'Unknown' when not specified via the `vk::image_format` attribute. If this option is not used, the format is inferred from the resource's data type.")
246246

247247
LANGOPT(CUDAIsDevice , 1, 0, NotCompatible, "compiling for CUDA device")
248-
LANGOPT(CUDAAllowVariadicFunctions, 1, 0, NotCompatible, "allowing variadic functions in CUDA device code")
249248
LANGOPT(CUDAHostDeviceConstexpr, 1, 1, NotCompatible, "treating unattributed constexpr functions as __host__ __device__")
250249
LANGOPT(GPUDeviceApproxTranscendentals, 1, 0, NotCompatible, "using approximate transcendental functions")
251250
LANGOPT(GPURelocatableDeviceCode, 1, 0, NotCompatible, "generate relocatable device code")

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
125125
cir::ConstantOp getTrue(mlir::Location loc) { return getBool(true, loc); }
126126

127127
cir::BoolType getBoolTy() { return cir::BoolType::get(getContext()); }
128+
cir::VoidType getVoidTy() { return cir::VoidType::get(getContext()); }
128129

129130
cir::PointerType getPointerTo(mlir::Type ty) {
130131
return cir::PointerType::get(ty);

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ struct MissingFeatures {
3737
static bool opGlobalDLLImportExport() { return false; }
3838
static bool opGlobalPartition() { return false; }
3939
static bool opGlobalUsedOrCompilerUsed() { return false; }
40+
static bool opGlobalAnnotations() { return false; }
41+
static bool opGlobalDtorLowering() { return false; }
42+
static bool opGlobalCtorAttr() { return false; }
43+
static bool opGlobalCtorPriority() { return false; }
44+
static bool opGlobalCtorList() { return false; }
4045
static bool setDSOLocal() { return false; }
4146
static bool setComdat() { return false; }
4247

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8387,6 +8387,11 @@ def fprofile_instrument_path_EQ : Joined<["-"], "fprofile-instrument-path=">,
83878387
HelpText<"Generate instrumented code to collect execution counts into "
83888388
"<file> (overridden by LLVM_PROFILE_FILE env var)">,
83898389
MarshallingInfoString<CodeGenOpts<"InstrProfileOutput">>;
8390+
def fprofile_instrument_use_EQ : Joined<["-"], "fprofile-instrument-use=">,
8391+
HelpText<"Enable PGO use instrumentation">, Values<"none,clang,llvm,csllvm,sample-coldcov">,
8392+
NormalizedValuesScope<"llvm::driver::ProfileInstrKind">,
8393+
NormalizedValues<["ProfileNone", "ProfileClangInstr", "ProfileIRInstr", "ProfileCSIRInstr", "ProfileIRSampleColdCov"]>,
8394+
MarshallingInfoEnum<CodeGenOpts<"ProfileUse">, "ProfileNone">;
83908395
def fprofile_instrument_use_path_EQ :
83918396
Joined<["-"], "fprofile-instrument-use-path=">,
83928397
HelpText<"Specify the profile path in PGO use compilation">,
@@ -9175,8 +9180,7 @@ def fcuda_include_gpubinary : Separate<["-"], "fcuda-include-gpubinary">,
91759180
HelpText<"Incorporate CUDA device-side binary into host object file.">,
91769181
MarshallingInfoString<CodeGenOpts<"CudaGpuBinaryFileName">>;
91779182
def fcuda_allow_variadic_functions : Flag<["-"], "fcuda-allow-variadic-functions">,
9178-
HelpText<"Allow variadic functions in CUDA device code.">,
9179-
MarshallingInfoFlag<LangOpts<"CUDAAllowVariadicFunctions">>;
9183+
HelpText<"Deprecated; Allow variadic functions in CUDA device code.">;
91809184
def fno_cuda_host_device_constexpr : Flag<["-"], "fno-cuda-host-device-constexpr">,
91819185
HelpText<"Don't treat unattributed constexpr functions as __host__ __device__.">,
91829186
MarshallingInfoNegativeFlag<LangOpts<"CUDAHostDeviceConstexpr">>;

0 commit comments

Comments
 (0)