Skip to content

Commit 6f2e7d9

Browse files
committed
Merge from 'main' to 'sycl-web' (#1)
2 parents 234996e + 92ce6db commit 6f2e7d9

File tree

194 files changed

+3283
-1115
lines changed

Some content is hidden

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

194 files changed

+3283
-1115
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
Jon Roelofs <[email protected]> Jon Roelofs <[email protected]>
3232
Jon Roelofs <[email protected]> Jonathan Roelofs <[email protected]>
3333
Jon Roelofs <[email protected]> Jonathan Roelofs <[email protected]>
34+
LLVM GN Syncbot <[email protected]>
3435
Martin Storsjö <[email protected]>
3536
Saleem Abdulrasool <[email protected]> <[email protected]>

clang-tools-extra/clangd/AST.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,22 @@ std::vector<const Attr *> getAttributes(const DynTypedNode &N) {
488488
if (const auto *TL = N.get<TypeLoc>()) {
489489
for (AttributedTypeLoc ATL = TL->getAs<AttributedTypeLoc>(); !ATL.isNull();
490490
ATL = ATL.getModifiedLoc().getAs<AttributedTypeLoc>()) {
491-
Result.push_back(ATL.getAttr());
491+
if (const Attr *A = ATL.getAttr())
492+
Result.push_back(A);
492493
assert(!ATL.getModifiedLoc().isNull());
493494
}
494495
}
495-
if (const auto *S = N.get<AttributedStmt>())
496+
if (const auto *S = N.get<AttributedStmt>()) {
496497
for (; S != nullptr; S = dyn_cast<AttributedStmt>(S->getSubStmt()))
497-
llvm::copy(S->getAttrs(), std::back_inserter(Result));
498-
if (const auto *D = N.get<Decl>())
499-
llvm::copy(D->attrs(), std::back_inserter(Result));
498+
for (const Attr *A : S->getAttrs())
499+
if (A)
500+
Result.push_back(A);
501+
}
502+
if (const auto *D = N.get<Decl>()) {
503+
for (const Attr *A : D->attrs())
504+
if (A)
505+
Result.push_back(A);
506+
}
500507
return Result;
501508
}
502509

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,15 @@ TEST(SelectionTest, CommonAncestor) {
465465
// Digraph syntax for attributes to avoid accidental annotations.
466466
class <:[gsl::Owner([[in^t]])]:> X{};
467467
)cpp",
468-
"BuiltinTypeLoc"}};
468+
"BuiltinTypeLoc"},
469+
470+
// This case used to crash - AST has a null Attr
471+
{R"cpp(
472+
@interface I
473+
[[@property(retain, nonnull) <:[My^Object2]:> *x]]; // error-ok
474+
@end
475+
)cpp",
476+
"ObjCPropertyDecl"}};
469477

470478
for (const Case &C : Cases) {
471479
trace::TestTracer Tracer;

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ def err_nullability_conflicting : Error<
149149

150150
// OpenCL Section 6.8.g
151151
def err_opencl_unknown_type_specifier : Error<
152-
"%select{OpenCL C|C++ for OpenCL}0 version %1 does not support the "
153-
"'%2' %select{type qualifier|storage class specifier}3">;
152+
"%0 does not support the '%1' "
153+
"%select{type qualifier|storage class specifier}2">;
154154

155155
def warn_unknown_attribute_ignored : Warning<
156156
"unknown attribute %0 ignored">, InGroup<UnknownAttributes>;

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def err_invalid_vfs_overlay : Error<
247247
"invalid virtual filesystem overlay file '%0'">, DefaultFatal;
248248

249249
def warn_option_invalid_ocl_version : Warning<
250-
"OpenCL version %0 does not support the option '%1'">, InGroup<Deprecated>;
250+
"%0 does not support the option '%1'">, InGroup<Deprecated>;
251251

252252
def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
253253
def err_function_needs_feature : Error<

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,7 @@ def err_attribute_requires_positive_integer : Error<
29982998
"%0 attribute requires a %select{positive|non-negative}1 "
29992999
"integral compile time constant expression">;
30003000
def err_attribute_requires_opencl_version : Error<
3001-
"%0 attribute requires OpenCL version %1%select{| or above}2">;
3001+
"attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
30023002
def err_invalid_branch_protection_spec : Error<
30033003
"invalid or misplaced branch protection specification '%0'">;
30043004
def warn_unsupported_target_attribute
@@ -10148,8 +10148,7 @@ def err_opencl_type_can_only_be_used_as_function_parameter : Error <
1014810148
def err_opencl_type_not_found : Error<
1014910149
"%0 type %1 not found; include the base header with -finclude-default-header">;
1015010150
def warn_opencl_attr_deprecated_ignored : Warning <
10151-
"%0 attribute is deprecated and ignored in OpenCL version %1">,
10152-
InGroup<IgnoredAttributes>;
10151+
"%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
1015310152
def err_opencl_variadic_function : Error<
1015410153
"invalid prototype, variadic arguments are not allowed in OpenCL">;
1015510154
def err_opencl_requires_extension : Error<
@@ -10216,7 +10215,7 @@ def err_opencl_builtin_expected_type : Error<
1021610215

1021710216
// OpenCL v3.0 s6.3.7 - Vector Components
1021810217
def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10219-
"vector component name '%0' is an OpenCL C version 3.0 feature">,
10218+
"vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
1022010219
InGroup<OpenCLUnsupportedRGBA>;
1022110220

1022210221
def err_openclcxx_placement_new : Error<

clang/include/clang/Basic/LangOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ class LangOptions : public LangOptionsBase {
462462
/// Return the OpenCL C or C++ version as a VersionTuple.
463463
VersionTuple getOpenCLVersionTuple() const;
464464

465+
/// Return the OpenCL C or C++ for OpenCL language name and version
466+
/// as a string.
467+
std::string getOpenCLVersionString() const;
468+
465469
/// Check if return address signing is enabled.
466470
bool hasSignReturnAddress() const {
467471
return getSignReturnAddressScope() != SignReturnAddressScopeKind::None;

clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ namespace dependencies {
3030

3131
class DependencyScanningWorkerFilesystem;
3232

33+
/// Compilation database that holds and reports a single compile command.
34+
class SingleCommandCompilationDatabase : public CompilationDatabase {
35+
CompileCommand Command;
36+
37+
public:
38+
SingleCommandCompilationDatabase(CompileCommand Cmd)
39+
: Command(std::move(Cmd)) {}
40+
41+
std::vector<CompileCommand>
42+
getCompileCommands(StringRef FilePath) const override {
43+
return {Command};
44+
}
45+
46+
std::vector<CompileCommand> getAllCompileCommands() const override {
47+
return {Command};
48+
}
49+
};
50+
3351
class DependencyConsumer {
3452
public:
3553
virtual ~DependencyConsumer() {}

clang/lib/AST/AttrDocTable.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//===--- AttrDocTable.cpp - implements Attr::getDocumentation() -*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file contains out-of-line methods for Attr classes.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#include "clang/AST/Attr.h"
14+
#include "llvm/ADT/StringRef.h"
15+
16+
#include "AttrDocTable.inc"
17+
18+
static const llvm::StringRef AttrDoc[] = {
19+
#define ATTR(NAME) AttrDoc_##NAME,
20+
#include "clang/Basic/AttrList.inc"
21+
};
22+
23+
llvm::StringRef clang::Attr::getDocumentation(clang::attr::Kind K) {
24+
if(K < llvm::array_lengthof(AttrDoc))
25+
return AttrDoc[K];
26+
return "";
27+
}

clang/lib/AST/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ clang_tablegen(Opcodes.inc
1313
SOURCE Interp/Opcodes.td
1414
TARGET Opcodes)
1515

16-
clang_tablegen(AttrDocTable.cpp -gen-clang-attr-doc-table
16+
clang_tablegen(AttrDocTable.inc -gen-clang-attr-doc-table
1717
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../include/
1818
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../../include/clang/Basic/Attr.td
1919
TARGET ClangAttrDocTable)
@@ -124,6 +124,7 @@ add_clang_library(clangAST
124124
clangLex
125125

126126
DEPENDS
127+
ClangAttrDocTable
127128
Opcodes
128129
omp_gen
129130
)

clang/lib/Basic/LangOptions.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ void LangOptions::remapPathPrefix(SmallString<256> &Path) const {
5656
break;
5757
}
5858

59+
std::string LangOptions::getOpenCLVersionString() const {
60+
std::string Result;
61+
{
62+
llvm::raw_string_ostream Out(Result);
63+
Out << (OpenCLCPlusPlus ? "C++ for OpenCL" : "OpenCL C") << " version "
64+
<< getOpenCLVersionTuple().getAsString();
65+
}
66+
return Result;
67+
}
68+
5969
FPOptions FPOptions::defaultWithoutTrailingStorage(const LangOptions &LO) {
6070
FPOptions result(LO);
6171
return result;

clang/lib/CodeGen/CGCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5251,7 +5251,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
52515251
CannotThrow = true;
52525252
} else {
52535253
// Otherwise, nounwind call sites will never throw.
5254-
CannotThrow = Attrs.hasFnAttribute(llvm::Attribute::NoUnwind);
5254+
CannotThrow = Attrs.hasFnAttr(llvm::Attribute::NoUnwind);
52555255

52565256
if (auto *FPtr = dyn_cast<llvm::Function>(CalleePtr))
52575257
if (FPtr->hasFnAttribute(llvm::Attribute::NoUnwind))

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3621,7 +3621,8 @@ void CodeGenFunction::EmitOMPForDirective(const OMPForDirective &S) {
36213621
CGM.getOpenMPRuntime().getOMPBuilder();
36223622
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP(
36233623
AllocaInsertPt->getParent(), AllocaInsertPt->getIterator());
3624-
OMPBuilder.createWorkshareLoop(Builder, CLI, AllocaIP, NeedsBarrier);
3624+
OMPBuilder.applyWorkshareLoop(Builder.getCurrentDebugLocation(), CLI,
3625+
AllocaIP, NeedsBarrier);
36253626
return;
36263627
}
36273628

clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,34 @@ static bool checkSystemForAMDGPU(const ArgList &Args, const AMDGPUToolChain &TC,
8686
} // namespace
8787

8888
const char *AMDGCN::OpenMPLinker::constructLLVMLinkCommand(
89-
Compilation &C, const JobAction &JA, const InputInfoList &Inputs,
90-
const ArgList &Args, StringRef SubArchName,
91-
StringRef OutputFilePrefix) const {
89+
const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC, Compilation &C,
90+
const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args,
91+
StringRef SubArchName, StringRef OutputFilePrefix) const {
9292
ArgStringList CmdArgs;
9393

9494
for (const auto &II : Inputs)
9595
if (II.isFilename())
9696
CmdArgs.push_back(II.getFilename());
97+
98+
if (Args.hasArg(options::OPT_l)) {
99+
auto Lm = Args.getAllArgValues(options::OPT_l);
100+
bool HasLibm = false;
101+
for (auto &Lib : Lm) {
102+
if (Lib == "m") {
103+
HasLibm = true;
104+
break;
105+
}
106+
}
107+
108+
if (HasLibm) {
109+
SmallVector<std::string, 12> BCLibs =
110+
AMDGPUOpenMPTC.getCommonDeviceLibNames(Args, SubArchName.str());
111+
llvm::for_each(BCLibs, [&](StringRef BCFile) {
112+
CmdArgs.push_back(Args.MakeArgString(BCFile));
113+
});
114+
}
115+
}
116+
97117
// Add an intermediate output file.
98118
CmdArgs.push_back("-o");
99119
const char *OutputFileName =
@@ -182,8 +202,8 @@ void AMDGCN::OpenMPLinker::ConstructJob(Compilation &C, const JobAction &JA,
182202
assert(Prefix.length() && "no linker inputs are files ");
183203

184204
// Each command outputs different files.
185-
const char *LLVMLinkCommand =
186-
constructLLVMLinkCommand(C, JA, Inputs, Args, GPUArch, Prefix);
205+
const char *LLVMLinkCommand = constructLLVMLinkCommand(
206+
AMDGPUOpenMPTC, C, JA, Inputs, Args, GPUArch, Prefix);
187207

188208
// Produce readable assembly if save-temps is enabled.
189209
if (C.getDriver().isSaveTempsEnabled())
@@ -234,27 +254,6 @@ void AMDGPUOpenMPToolChain::addClangTargetOptions(
234254

235255
addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, BitcodeSuffix,
236256
getTriple());
237-
238-
if (!DriverArgs.hasArg(options::OPT_l))
239-
return;
240-
241-
auto Lm = DriverArgs.getAllArgValues(options::OPT_l);
242-
bool HasLibm = false;
243-
for (auto &Lib : Lm) {
244-
if (Lib == "m") {
245-
HasLibm = true;
246-
break;
247-
}
248-
}
249-
250-
if (HasLibm) {
251-
SmallVector<std::string, 12> BCLibs =
252-
getCommonDeviceLibNames(DriverArgs, GPUArch);
253-
llvm::for_each(BCLibs, [&](StringRef BCFile) {
254-
CC1Args.push_back("-mlink-builtin-bitcode");
255-
CC1Args.push_back(DriverArgs.MakeArgString(BCFile));
256-
});
257-
}
258257
}
259258

260259
llvm::opt::DerivedArgList *AMDGPUOpenMPToolChain::TranslateArgs(

clang/lib/Driver/ToolChains/AMDGPUOpenMP.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
namespace clang {
1717
namespace driver {
1818

19+
namespace toolchains {
20+
class AMDGPUOpenMPToolChain;
21+
}
22+
1923
namespace tools {
2024

2125
namespace AMDGCN {
@@ -35,11 +39,11 @@ class LLVM_LIBRARY_VISIBILITY OpenMPLinker : public Tool {
3539

3640
private:
3741
/// \return llvm-link output file name.
38-
const char *constructLLVMLinkCommand(Compilation &C, const JobAction &JA,
39-
const InputInfoList &Inputs,
40-
const llvm::opt::ArgList &Args,
41-
llvm::StringRef SubArchName,
42-
llvm::StringRef OutputFilePrefix) const;
42+
const char *constructLLVMLinkCommand(
43+
const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC, Compilation &C,
44+
const JobAction &JA, const InputInfoList &Inputs,
45+
const llvm::opt::ArgList &Args, llvm::StringRef SubArchName,
46+
llvm::StringRef OutputFilePrefix) const;
4347

4448
/// \return llc output file name.
4549
const char *constructLlcCommand(Compilation &C, const JobAction &JA,

clang/lib/Driver/ToolChains/Arch/ARM.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ arm::FloatABI arm::getDefaultFloatABI(const llvm::Triple &Triple) {
314314

315315
// FIXME: this is invalid for WindowsCE
316316
case llvm::Triple::Win32:
317+
// It is incorrect to select hard float ABI on MachO platforms if the ABI is
318+
// "apcs-gnu".
319+
if (Triple.isOSBinFormatMachO() && !useAAPCSForMachO(Triple))
320+
return FloatABI::Soft;
317321
return FloatABI::Hard;
318322

319323
case llvm::Triple::NetBSD:

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,10 @@ static bool FixupInvocation(CompilerInvocation &Invocation,
503503
// -cl-strict-aliasing needs to emit diagnostic in the case where CL > 1.0.
504504
// This option should be deprecated for CL > 1.0 because
505505
// this option was added for compatibility with OpenCL 1.0.
506-
if (Args.getLastArg(OPT_cl_strict_aliasing) && LangOpts.OpenCLVersion > 100)
506+
if (Args.getLastArg(OPT_cl_strict_aliasing) &&
507+
(LangOpts.OpenCLCPlusPlus || LangOpts.OpenCLVersion > 100))
507508
Diags.Report(diag::warn_option_invalid_ocl_version)
508-
<< LangOpts.getOpenCLVersionTuple().getAsString()
509+
<< LangOpts.getOpenCLVersionString()
509510
<< Args.getLastArg(OPT_cl_strict_aliasing)->getAsString(Args);
510511

511512
if (Arg *A = Args.getLastArg(OPT_fdefault_calling_conv_EQ)) {

clang/lib/Headers/__wmmintrin_aes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ _mm_aesimc_si128(__m128i __V)
133133
/// An 8-bit round constant used to generate the AES encryption key.
134134
/// \returns A 128-bit round key for AES encryption.
135135
#define _mm_aeskeygenassist_si128(C, R) \
136-
(__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R))
136+
((__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R)))
137137

138138
#undef __DEFAULT_FN_ATTRS
139139

0 commit comments

Comments
 (0)