Skip to content

Commit cc68b56

Browse files
committed
Merge from 'main' to 'sycl-web' (49 commits)
2 parents 46724f5 + 24a12a9 commit cc68b56

File tree

122 files changed

+3538
-1851
lines changed

Some content is hidden

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

122 files changed

+3538
-1851
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ TEST(ClangdServerTest, SearchLibDir) {
392392
ErrorCheckingCallbacks DiagConsumer;
393393
MockCompilationDatabase CDB;
394394
CDB.ExtraClangFlags.insert(CDB.ExtraClangFlags.end(),
395-
{"-xc++", "-target", "x86_64-linux-unknown",
395+
{"-xc++", "--target=x86_64-unknown-linux-gnu",
396396
"-m64", "--gcc-toolchain=/randomusr",
397397
"-stdlib=libstdc++"});
398398
ClangdServer Server(CDB, FS, ClangdServer::optsForTest(), &DiagConsumer);

clang/docs/InternalsManual.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,44 @@ severe that error recovery won't be able to recover sensibly from them (thus
123123
spewing a ton of bogus errors). One example of this class of error are failure
124124
to ``#include`` a file.
125125

126+
Diagnostic Wording
127+
^^^^^^^^^^^^^^^^^^
128+
The wording used for a diagnostic is critical because it is the only way for a
129+
user to know how to correct their code. Use the following suggestions when
130+
wording a diagnostic.
131+
132+
* Diagnostics in Clang do not start with a capital letter and do not end with
133+
punctuation.
134+
135+
* This does not apply to proper nouns like ``Clang`` or ``OpenMP``, to
136+
acronyms like ``GCC`` or ``ARC``, or to language standards like ``C23``
137+
or ``C++17``.
138+
* A trailing question mark is allowed. e.g., ``unknown identifier %0; did
139+
you mean %1?``.
140+
141+
* Appropriately capitalize proper nouns like ``Clang``, ``OpenCL``, ``GCC``,
142+
``Objective-C``, etc and language standard versions like ``C11`` or ``C++11``.
143+
* The wording should be succinct. If necessary, use a semicolon to combine
144+
sentence fragments instead of using complete sentences. e.g., prefer wording
145+
like ``'%0' is deprecated; it will be removed in a future release of Clang``
146+
over wording like ``'%0' is deprecated. It will be removed in a future release
147+
of Clang``.
148+
* The wording should be actionable and avoid using standards terms or grammar
149+
productions that a new user would not be familiar with. e.g., prefer wording
150+
like ``missing semicolon`` over wording like ``syntax error`` (which is not
151+
actionable) or ``expected unqualified-id`` (which uses standards terminology).
152+
* The wording should clearly explain what is wrong with the code rather than
153+
restating what the code does. e.g., prefer wording like ``type %0 requires a
154+
value in the range %1 to %2`` over wording like ``%0 is invalid``.
155+
* The wording should have enough contextual information to help the user
156+
identify the issue in a complex expression. e.g., prefer wording like
157+
``both sides of the %0 binary operator are identical`` over wording like
158+
``identical operands to binary operator``.
159+
* Use single quotes to denote syntactic constructs or command line arguments
160+
named in a diagnostic message. e.g., prefer wording like ``'this' pointer
161+
cannot be null in well-defined C++ code`` over wording like ``this pointer
162+
cannot be null in well-defined C++ code``.
163+
126164
The Format String
127165
^^^^^^^^^^^^^^^^^
128166

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def err_drv_Xsycl_target_missing_triple : Error<
210210
def err_drv_invalid_Xsycl_frontend_with_args : Error<
211211
"invalid -Xsycl-target-frontend argument: '%0', options requiring arguments are unsupported">;
212212
def err_drv_bad_fpga_device_count : Error<
213-
"More than one FPGA specific device binary found in input objects">;
213+
"more than one FPGA specific device binary found in input objects">;
214214
def warn_drv_mismatch_fpga_archive : Warning<
215215
"FPGA archive '%0' does not contain matching emulation/hardware expectancy">,
216216
InGroup<SyclFPGAMismatch>;
@@ -374,7 +374,7 @@ def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, plea
374374
def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
375375
def err_drv_invalid_sycl_target : Error<"SYCL target is invalid: '%0'">;
376376
def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' pointer size is incompatible with host '%1'">;
377-
def err_drv_option_conflict : Error<"The option %0 conflicts with %1">;
377+
def err_drv_option_conflict : Error<"the option %0 conflicts with %1">;
378378
def err_drv_omp_host_ir_file_not_found : Error<
379379
"provided host compiler IR file '%0' is required to generate code for OpenMP "
380380
"target regions but cannot be found">;
@@ -388,7 +388,7 @@ def err_drv_expecting_fsycl_with_sycl_opt : Error<
388388
def err_drv_fsycl_with_c_type : Error<
389389
"'%0' must not be used in conjunction with '-fsycl', which expects C++ source">;
390390
def err_drv_fsycl_with_pch : Error<
391-
"Precompiled header generation is not supported with '-fsycl'">;
391+
"precompiled header generation is not supported with '-fsycl'">;
392392
def err_drv_fsycl_unsupported_with_opt
393393
: Error<"'%0' is not supported with '-fsycl'">;
394394
def warn_drv_opt_requires_opt
@@ -406,7 +406,7 @@ def err_drv_no_rdc_sycl_target_missing : Error<
406406
def err_drv_fsycl_wrong_optimization_options : Error<
407407
"-fsycl-optimize-non-user-code option can be used only in conjunction with %0">;
408408
def warn_drv_fsycl_add_default_spec_consts_image_flag_in_non_AOT : Warning<
409-
"-fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT).">,
409+
"-fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT)">,
410410
InGroup<SyclTarget>;
411411
def warn_drv_ftarget_register_alloc_mode_pvc : Warning<
412412
"using '%0' to set GRF mode on PVC hardware is deprecated; use '-ftarget-register-alloc-mode=pvc:%1'">,

clang/include/clang/Interpreter/Interpreter.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ class Interpreter {
110110
RuntimeInterfaceBuilder::TransformExprFunction *AddPrintValueCall = nullptr;
111111

112112
protected:
113-
// Derived classes can make use an extended interface of the Interpreter.
114-
// That's useful for testing and out-of-tree clients.
115-
Interpreter(std::unique_ptr<CompilerInstance> CI, llvm::Error &Err);
113+
// Derived classes can use an extended interface of the Interpreter.
114+
Interpreter(std::unique_ptr<CompilerInstance> CI, llvm::Error &Err,
115+
std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder = nullptr);
116116

117117
// Create the internal IncrementalExecutor, or re-create it after calling
118118
// ResetExecutor().
@@ -128,13 +128,6 @@ class Interpreter {
128128
// custom runtime.
129129
virtual std::unique_ptr<RuntimeInterfaceBuilder> FindRuntimeInterface();
130130

131-
// Lazily construct thev ORCv2 JITBuilder. This called when the internal
132-
// IncrementalExecutor is created. The default implementation populates an
133-
// in-process JIT with debugging support. Override this to configure the JIT
134-
// engine used for execution.
135-
virtual llvm::Expected<std::unique_ptr<llvm::orc::LLJITBuilder>>
136-
CreateJITBuilder(CompilerInstance &CI);
137-
138131
public:
139132
virtual ~Interpreter();
140133

@@ -189,6 +182,8 @@ class Interpreter {
189182
llvm::DenseMap<CXXRecordDecl *, llvm::orc::ExecutorAddr> Dtors;
190183

191184
llvm::SmallVector<Expr *, 4> ValuePrintingInfo;
185+
186+
std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder;
192187
};
193188
} // namespace clang
194189

clang/lib/AST/Interp/ByteCodeStmtGen.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -687,26 +687,29 @@ bool ByteCodeStmtGen<Emitter>::visitDefaultStmt(const DefaultStmt *S) {
687687
template <class Emitter>
688688
bool ByteCodeStmtGen<Emitter>::visitAttributedStmt(const AttributedStmt *S) {
689689

690-
for (const Attr *A : S->getAttrs()) {
691-
auto *AA = dyn_cast<CXXAssumeAttr>(A);
692-
if (!AA)
693-
continue;
690+
if (this->Ctx.getLangOpts().CXXAssumptions &&
691+
!this->Ctx.getLangOpts().MSVCCompat) {
692+
for (const Attr *A : S->getAttrs()) {
693+
auto *AA = dyn_cast<CXXAssumeAttr>(A);
694+
if (!AA)
695+
continue;
694696

695-
assert(isa<NullStmt>(S->getSubStmt()));
697+
assert(isa<NullStmt>(S->getSubStmt()));
696698

697-
const Expr *Assumption = AA->getAssumption();
698-
if (Assumption->isValueDependent())
699-
return false;
699+
const Expr *Assumption = AA->getAssumption();
700+
if (Assumption->isValueDependent())
701+
return false;
700702

701-
if (Assumption->HasSideEffects(this->Ctx.getASTContext()))
702-
continue;
703+
if (Assumption->HasSideEffects(this->Ctx.getASTContext()))
704+
continue;
703705

704-
// Evaluate assumption.
705-
if (!this->visitBool(Assumption))
706-
return false;
706+
// Evaluate assumption.
707+
if (!this->visitBool(Assumption))
708+
return false;
707709

708-
if (!this->emitAssume(Assumption))
709-
return false;
710+
if (!this->emitAssume(Assumption))
711+
return false;
712+
}
710713
}
711714

712715
// Ignore other attributes.

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,19 +2366,10 @@ void Generic_GCC::GCCInstallationDetector::init(
23662366
SmallVector<StringRef, 16> CandidateBiarchTripleAliases;
23672367
// Add some triples that we want to check first.
23682368
CandidateTripleAliases.push_back(TargetTriple.str());
2369-
std::string TripleNoVendor, BiarchTripleNoVendor;
2370-
if (TargetTriple.getVendor() == llvm::Triple::UnknownVendor) {
2371-
StringRef OSEnv = TargetTriple.getOSAndEnvironmentName();
2372-
if (TargetTriple.getEnvironment() == llvm::Triple::GNUX32)
2373-
OSEnv = "linux-gnu";
2374-
TripleNoVendor = (TargetTriple.getArchName().str() + '-' + OSEnv).str();
2369+
std::string TripleNoVendor = TargetTriple.getArchName().str() + "-" +
2370+
TargetTriple.getOSAndEnvironmentName().str();
2371+
if (TargetTriple.getVendor() == llvm::Triple::UnknownVendor)
23752372
CandidateTripleAliases.push_back(TripleNoVendor);
2376-
if (BiarchVariantTriple.getArch() != llvm::Triple::UnknownArch) {
2377-
BiarchTripleNoVendor =
2378-
(BiarchVariantTriple.getArchName().str() + '-' + OSEnv).str();
2379-
CandidateBiarchTripleAliases.push_back(BiarchTripleNoVendor);
2380-
}
2381-
}
23822373

23832374
CollectLibDirsAndTriples(TargetTriple, BiarchVariantTriple, CandidateLibDirs,
23842375
CandidateTripleAliases, CandidateBiarchLibDirs,
@@ -2601,9 +2592,11 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
26012592
// lists should shrink over time. Please don't add more elements to *Triples.
26022593
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
26032594
static const char *const AArch64Triples[] = {
2604-
"aarch64-none-linux-gnu", "aarch64-redhat-linux", "aarch64-suse-linux"};
2595+
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
2596+
"aarch64-suse-linux"};
26052597
static const char *const AArch64beLibDirs[] = {"/lib"};
2606-
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu"};
2598+
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
2599+
"aarch64_be-linux-gnu"};
26072600

26082601
static const char *const ARMLibDirs[] = {"/lib"};
26092602
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
@@ -2625,44 +2618,47 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
26252618

26262619
static const char *const X86_64LibDirs[] = {"/lib64", "/lib"};
26272620
static const char *const X86_64Triples[] = {
2628-
"x86_64-unknown-linux-gnu", "x86_64-pc-linux-gnu",
2629-
"x86_64-redhat-linux6E", "x86_64-redhat-linux",
2630-
"x86_64-suse-linux", "x86_64-manbo-linux-gnu",
2631-
"x86_64-slackware-linux", "x86_64-unknown-linux",
2621+
"x86_64-linux-gnu", "x86_64-unknown-linux-gnu",
2622+
"x86_64-pc-linux-gnu", "x86_64-redhat-linux6E",
2623+
"x86_64-redhat-linux", "x86_64-suse-linux",
2624+
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
2625+
"x86_64-slackware-linux", "x86_64-unknown-linux",
26322626
"x86_64-amazon-linux"};
26332627
static const char *const X32Triples[] = {"x86_64-linux-gnux32",
26342628
"x86_64-pc-linux-gnux32"};
26352629
static const char *const X32LibDirs[] = {"/libx32", "/lib"};
26362630
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
26372631
static const char *const X86Triples[] = {
2638-
"i686-linux-gnu", "i686-pc-linux-gnu", "i386-redhat-linux6E",
2639-
"i686-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
2640-
"i686-montavista-linux",
2632+
"i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu",
2633+
"i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux",
2634+
"i586-suse-linux", "i686-montavista-linux",
26412635
};
26422636

26432637
static const char *const LoongArch64LibDirs[] = {"/lib64", "/lib"};
26442638
static const char *const LoongArch64Triples[] = {
26452639
"loongarch64-linux-gnu", "loongarch64-unknown-linux-gnu"};
26462640

26472641
static const char *const M68kLibDirs[] = {"/lib"};
2648-
static const char *const M68kTriples[] = {"m68k-unknown-linux-gnu",
2649-
"m68k-suse-linux"};
2642+
static const char *const M68kTriples[] = {
2643+
"m68k-linux-gnu", "m68k-unknown-linux-gnu", "m68k-suse-linux"};
26502644

26512645
static const char *const MIPSLibDirs[] = {"/libo32", "/lib"};
26522646
static const char *const MIPSTriples[] = {
26532647
"mips-linux-gnu", "mips-mti-linux", "mips-mti-linux-gnu",
26542648
"mips-img-linux-gnu", "mipsisa32r6-linux-gnu"};
26552649
static const char *const MIPSELLibDirs[] = {"/libo32", "/lib"};
2656-
static const char *const MIPSELTriples[] = {"mipsel-linux-gnu",
2657-
"mips-img-linux-gnu"};
2650+
static const char *const MIPSELTriples[] = {
2651+
"mipsel-linux-gnu", "mips-img-linux-gnu", "mipsisa32r6el-linux-gnu"};
26582652

26592653
static const char *const MIPS64LibDirs[] = {"/lib64", "/lib"};
26602654
static const char *const MIPS64Triples[] = {
2661-
"mips-mti-linux-gnu", "mips-img-linux-gnu", "mips64-linux-gnuabi64",
2655+
"mips64-linux-gnu", "mips-mti-linux-gnu",
2656+
"mips-img-linux-gnu", "mips64-linux-gnuabi64",
26622657
"mipsisa64r6-linux-gnu", "mipsisa64r6-linux-gnuabi64"};
26632658
static const char *const MIPS64ELLibDirs[] = {"/lib64", "/lib"};
26642659
static const char *const MIPS64ELTriples[] = {
2665-
"mips-mti-linux-gnu", "mips-img-linux-gnu", "mips64el-linux-gnuabi64",
2660+
"mips64el-linux-gnu", "mips-mti-linux-gnu",
2661+
"mips-img-linux-gnu", "mips64el-linux-gnuabi64",
26662662
"mipsisa64r6el-linux-gnu", "mipsisa64r6el-linux-gnuabi64"};
26672663

26682664
static const char *const MIPSN32LibDirs[] = {"/lib32"};
@@ -2677,39 +2673,46 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
26772673

26782674
static const char *const PPCLibDirs[] = {"/lib32", "/lib"};
26792675
static const char *const PPCTriples[] = {
2680-
"powerpc-unknown-linux-gnu",
2676+
"powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe",
26812677
// On 32-bit PowerPC systems running SUSE Linux, gcc is configured as a
26822678
// 64-bit compiler which defaults to "-m32", hence "powerpc64-suse-linux".
26832679
"powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
26842680
static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
2685-
static const char *const PPCLETriples[] = {"powerpcle-unknown-linux-gnu",
2681+
static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
2682+
"powerpcle-unknown-linux-gnu",
26862683
"powerpcle-linux-musl"};
26872684

26882685
static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
2689-
static const char *const PPC64Triples[] = {"powerpc64-unknown-linux-gnu",
2690-
"powerpc64-suse-linux",
2691-
"ppc64-redhat-linux"};
2686+
static const char *const PPC64Triples[] = {
2687+
"powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu",
2688+
"powerpc64-suse-linux", "ppc64-redhat-linux"};
26922689
static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
26932690
static const char *const PPC64LETriples[] = {
2694-
"powerpc64le-unknown-linux-gnu", "powerpc64le-none-linux-gnu",
2695-
"powerpc64le-suse-linux", "ppc64le-redhat-linux"};
2691+
"powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
2692+
"powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
2693+
"ppc64le-redhat-linux"};
26962694

26972695
static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
26982696
static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",
2697+
"riscv32-linux-gnu",
26992698
"riscv32-unknown-elf"};
27002699
static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
27012700
static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
2701+
"riscv64-linux-gnu",
27022702
"riscv64-unknown-elf"};
27032703

27042704
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
2705-
static const char *const SPARCv8Triples[] = {"sparcv8-linux-gnu"};
2705+
static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
2706+
"sparcv8-linux-gnu"};
27062707
static const char *const SPARCv9LibDirs[] = {"/lib64", "/lib"};
2707-
static const char *const SPARCv9Triples[] = {"sparcv9-linux-gnu"};
2708+
static const char *const SPARCv9Triples[] = {"sparc64-linux-gnu",
2709+
"sparcv9-linux-gnu"};
27082710

27092711
static const char *const SystemZLibDirs[] = {"/lib64", "/lib"};
27102712
static const char *const SystemZTriples[] = {
2711-
"s390x-unknown-linux-gnu", "s390x-ibm-linux-gnu", "s390x-suse-linux",
2712-
"s390x-redhat-linux"};
2713+
"s390x-linux-gnu", "s390x-unknown-linux-gnu", "s390x-ibm-linux-gnu",
2714+
"s390x-suse-linux", "s390x-redhat-linux"};
2715+
27132716

27142717
using std::begin;
27152718
using std::end;

0 commit comments

Comments
 (0)