Skip to content

Commit bbc7751

Browse files
committed
Merge from 'master' to 'sycl-web' (#3)
CONFLICT (content): Merge conflict in clang/test/SemaTemplate/address_space-dependent.cpp CONFLICT (content): Merge conflict in clang/test/CodeGenCXX/mangle-address-space.cpp CONFLICT (content): Merge conflict in clang/lib/Basic/Targets/SPIR.h CONFLICT (content): Merge conflict in clang/lib/AST/MicrosoftMangle.cpp CONFLICT (content): Merge conflict in clang/lib/AST/ItaniumMangle.cpp CONFLICT (content): Merge conflict in clang/lib/AST/ASTContext.cpp CONFLICT (content): Merge conflict in clang/include/clang/Basic/AttrDocs.td CONFLICT (content): Merge conflict in clang/include/clang/Basic/Attr.td CONFLICT (content): Merge conflict in clang/include/clang/AST/Type.h
2 parents 958d599 + 8d27be8 commit bbc7751

File tree

408 files changed

+12478
-6446
lines changed

Some content is hidden

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

408 files changed

+12478
-6446
lines changed

clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class Export : public Command {
283283
};
284284

285285
public:
286-
void run() {
286+
void run() override {
287287
using namespace clang::clangd;
288288
// Read input file (as specified in global option)
289289
auto Buffer = llvm::MemoryBuffer::getFile(IndexLocation);

clang-tools-extra/clangd/index/remote/server/Server.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ llvm::cl::opt<std::string> IndexPath(llvm::cl::desc("<INDEX FILE>"),
3939
llvm::cl::opt<std::string> IndexRoot(llvm::cl::desc("<PROJECT ROOT>"),
4040
llvm::cl::Positional, llvm::cl::Required);
4141

42+
llvm::cl::opt<Logger::Level> LogLevel{
43+
"log",
44+
llvm::cl::desc("Verbosity of log messages written to stderr"),
45+
values(clEnumValN(Logger::Error, "error", "Error messages only"),
46+
clEnumValN(Logger::Info, "info", "High level execution tracing"),
47+
clEnumValN(Logger::Debug, "verbose", "Low level details")),
48+
llvm::cl::init(Logger::Info),
49+
};
50+
4251
llvm::cl::opt<std::string> TraceFile(
4352
"trace-file",
4453
llvm::cl::desc("Path to the file where tracer logs will be stored"));
@@ -173,7 +182,7 @@ void runServer(std::unique_ptr<clangd::SymbolIndex> Index,
173182
Builder.AddListeningPort(ServerAddress, grpc::InsecureServerCredentials());
174183
Builder.RegisterService(&Service);
175184
std::unique_ptr<grpc::Server> Server(Builder.BuildAndStart());
176-
llvm::outs() << "Server listening on " << ServerAddress << '\n';
185+
log("Server listening on {0}", ServerAddress);
177186

178187
Server->Wait();
179188
}
@@ -191,10 +200,16 @@ int main(int argc, char *argv[]) {
191200
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
192201

193202
if (!llvm::sys::path::is_absolute(IndexRoot)) {
194-
elog("Index root should be an absolute path.");
203+
llvm::errs() << "Index root should be an absolute path.\n";
195204
return -1;
196205
}
197206

207+
llvm::errs().SetBuffered();
208+
// Don't flush stdout when logging for thread safety.
209+
llvm::errs().tie(nullptr);
210+
clang::clangd::StreamLogger Logger(llvm::errs(), LogLevel);
211+
clang::clangd::LoggingSession LoggingSession(Logger);
212+
198213
llvm::Optional<llvm::raw_fd_ostream> TracerStream;
199214
std::unique_ptr<clang::clangd::trace::EventTracer> Tracer;
200215
if (!TraceFile.empty()) {
@@ -220,7 +235,7 @@ int main(int argc, char *argv[]) {
220235
std::unique_ptr<clang::clangd::SymbolIndex> Index = openIndex(IndexPath);
221236

222237
if (!Index) {
223-
elog("Failed to open the index.");
238+
llvm::errs() << "Failed to open the index.\n";
224239
return -1;
225240
}
226241

clang-tools-extra/clangd/indexer/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ clang_target_link_libraries(clangd-indexer
2020
target_link_libraries(clangd-indexer
2121
PRIVATE
2222
clangDaemon
23+
clangdSupport
2324
)

clang-tools-extra/clangd/indexer/IndexerMain.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "index/Serialization.h"
1717
#include "index/Symbol.h"
1818
#include "index/SymbolCollector.h"
19+
#include "support/Logger.h"
1920
#include "clang/Tooling/ArgumentsAdjusters.h"
2021
#include "clang/Tooling/CommonOptionsParser.h"
2122
#include "clang/Tooling/Execution.h"
@@ -122,7 +123,7 @@ int main(int argc, const char **argv) {
122123
std::make_unique<clang::clangd::IndexActionFactory>(Data),
123124
clang::tooling::getStripPluginsAdjuster());
124125
if (Err) {
125-
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
126+
clang::clangd::elog("{0}", std::move(Err));
126127
}
127128

128129
// Emit collected data.

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -657,16 +657,16 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
657657
// continuing.
658658
llvm::SmallString<128> Path(CompileCommandsDir);
659659
if (std::error_code EC = llvm::sys::fs::make_absolute(Path)) {
660-
llvm::errs() << "Error while converting the relative path specified by "
661-
"--compile-commands-dir to an absolute path: "
662-
<< EC.message() << ". The argument will be ignored.\n";
660+
elog("Error while converting the relative path specified by "
661+
"--compile-commands-dir to an absolute path: {0}. The argument "
662+
"will be ignored.",
663+
EC.message());
663664
} else {
664665
CompileCommandsDirPath = std::string(Path.str());
665666
}
666667
} else {
667-
llvm::errs()
668-
<< "Path specified by --compile-commands-dir does not exist. The "
669-
"argument will be ignored.\n";
668+
elog("Path specified by --compile-commands-dir does not exist. The "
669+
"argument will be ignored.");
670670
}
671671
}
672672

@@ -750,7 +750,7 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
750750
elog("Couldn't determine user config file, not loading");
751751
}
752752
std::vector<const config::Provider *> ProviderPointers;
753-
for (const auto& P : ProviderStack)
753+
for (const auto &P : ProviderStack)
754754
ProviderPointers.push_back(P.get());
755755
Config = config::Provider::combine(std::move(ProviderPointers));
756756
Opts.ConfigProvider = Config.get();

clang/include/clang/AST/DeclCXX.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ class CXXRecordDecl : public RecordDecl {
10251025
}
10261026

10271027
/// Set the captures for this lambda closure type.
1028-
void setCaptures(ArrayRef<LambdaCapture> Captures);
1028+
void setCaptures(ASTContext &Context, ArrayRef<LambdaCapture> Captures);
10291029

10301030
/// For a closure type, retrieve the mapping from captured
10311031
/// variables and \c this to the non-static data members that store the

clang/include/clang/AST/ExprConcepts.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ class ConceptSpecializationExpr final : public Expr, public ConceptReference,
126126
}
127127

128128
SourceLocation getEndLoc() const LLVM_READONLY {
129-
return ArgsAsWritten->RAngleLoc;
129+
// If the ConceptSpecializationExpr is the ImmediatelyDeclaredConstraint
130+
// of a TypeConstraint written syntactically as a constrained-parameter,
131+
// there may not be a template argument list.
132+
return ArgsAsWritten->RAngleLoc.isValid() ? ArgsAsWritten->RAngleLoc
133+
: ConceptName.getEndLoc();
130134
}
131135

132136
// Iterators

clang/include/clang/AST/Type.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ class Qualifiers {
483483
// We also define global_device and global_host address spaces,
484484
// to distinguish global pointers allocated on host from pointers
485485
// allocated on device, which are a subset of __global.
486-
// FIXME: add a reference to spec when ready
487486
(A == LangAS::opencl_global && (B == LangAS::opencl_global_device ||
488487
B == LangAS::opencl_global_host)) ||
489488
// Consider pointer size address spaces to be equivalent to default.

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,12 +1326,12 @@ def OpenCLGlobalAddressSpace : TypeAttr {
13261326

13271327
def OpenCLGlobalDeviceAddressSpace : TypeAttr {
13281328
let Spellings = [Clang<"opencl_global_device">];
1329-
let Documentation = [OpenCLGlobalAddressSpacesDocs];
1329+
let Documentation = [OpenCLAddressSpaceGlobalExtDocs];
13301330
}
13311331

13321332
def OpenCLGlobalHostAddressSpace : TypeAttr {
13331333
let Spellings = [Clang<"opencl_global_host">];
1334-
let Documentation = [OpenCLGlobalAddressSpacesDocs];
1334+
let Documentation = [OpenCLAddressSpaceGlobalExtDocs];
13351335
}
13361336

13371337
def OpenCLLocalAddressSpace : TypeAttr {

clang/include/clang/Basic/AttrDocs.td

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3600,14 +3600,27 @@ scope) variables and static local variable as well.
36003600
}];
36013601
}
36023602

3603-
def OpenCLGlobalAddressSpacesDocs : Documentation {
3603+
def OpenCLAddressSpaceGlobalExtDocs : Documentation {
36043604
let Category = DocOpenCLAddressSpaces;
36053605
let Heading = "[[clang::opencl_global_device]], [[clang::opencl_global_host]]";
36063606
let Content = [{
3607-
The (global_device) and (global_host) address space attributes specify that an
3608-
object is allocated in global memory on the device/host. It helps distinguishing
3609-
USM pointers that access device memory and accessors that access global memory
3610-
from those that access host memory.
3607+
The ``global_device`` and ``global_host`` address space attributes specify that
3608+
an object is allocated in global memory on the device/host. It helps to
3609+
distinguish USM (Unified Shared Memory) pointers that access global device
3610+
memory from those that access global host memory. These new address spaces are
3611+
a subset of the ``__global/opencl_global`` address space, the full address space
3612+
set model for OpenCL 2.0 with the extension looks as follows:
3613+
generic->global->host
3614+
->device
3615+
->private
3616+
->local
3617+
constant
3618+
3619+
As ``global_device`` and ``global_host`` are a subset of
3620+
``__global/opencl_global`` address spaces it is allowed to convert
3621+
``global_device`` and ``global_host`` address spaces to
3622+
``__global/opencl_global`` address spaces (following ISO/IEC TR 18037 5.1.3
3623+
"Address space nesting and rules for pointers).
36113624
}];
36123625
}
36133626

clang/include/clang/Basic/BuiltinsWebAssembly.def

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,5 @@ TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16cV8sV8s", "nc", "simd128
169169
TARGET_BUILTIN(__builtin_wasm_narrow_s_i16x8_i32x4, "V8sV4iV4i", "nc", "simd128")
170170
TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8sV4iV4i", "nc", "simd128")
171171

172-
TARGET_BUILTIN(__builtin_wasm_widen_low_s_i16x8_i8x16, "V8sV16c", "nc", "simd128")
173-
TARGET_BUILTIN(__builtin_wasm_widen_high_s_i16x8_i8x16, "V8sV16c", "nc", "simd128")
174-
TARGET_BUILTIN(__builtin_wasm_widen_low_u_i16x8_i8x16, "V8sV16c", "nc", "simd128")
175-
TARGET_BUILTIN(__builtin_wasm_widen_high_u_i16x8_i8x16, "V8sV16c", "nc", "simd128")
176-
TARGET_BUILTIN(__builtin_wasm_widen_low_s_i32x4_i16x8, "V4iV8s", "nc", "simd128")
177-
TARGET_BUILTIN(__builtin_wasm_widen_high_s_i32x4_i16x8, "V4iV8s", "nc", "simd128")
178-
TARGET_BUILTIN(__builtin_wasm_widen_low_u_i32x4_i16x8, "V4iV8s", "nc", "simd128")
179-
TARGET_BUILTIN(__builtin_wasm_widen_high_u_i32x4_i16x8, "V4iV8s", "nc", "simd128")
180-
181172
#undef BUILTIN
182173
#undef TARGET_BUILTIN

clang/include/clang/Basic/OpenMPKinds.def

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
#ifndef OPENMP_MAP_MODIFIER_KIND
3030
#define OPENMP_MAP_MODIFIER_KIND(Name)
3131
#endif
32-
#ifndef OPENMP_TO_MODIFIER_KIND
33-
#define OPENMP_TO_MODIFIER_KIND(Name)
34-
#endif
35-
#ifndef OPENMP_FROM_MODIFIER_KIND
36-
#define OPENMP_FROM_MODIFIER_KIND(Name)
32+
#ifndef OPENMP_MOTION_MODIFIER_KIND
33+
#define OPENMP_MOTION_MODIFIER_KIND(Name)
3734
#endif
3835
#ifndef OPENMP_DIST_SCHEDULE_KIND
3936
#define OPENMP_DIST_SCHEDULE_KIND(Name)
@@ -126,11 +123,8 @@ OPENMP_MAP_MODIFIER_KIND(close)
126123
OPENMP_MAP_MODIFIER_KIND(mapper)
127124
OPENMP_MAP_MODIFIER_KIND(present)
128125

129-
// Modifiers for 'to' clause.
130-
OPENMP_TO_MODIFIER_KIND(mapper)
131-
132-
// Modifiers for 'from' clause.
133-
OPENMP_FROM_MODIFIER_KIND(mapper)
126+
// Modifiers for 'to' or 'from' clause.
127+
OPENMP_MOTION_MODIFIER_KIND(mapper)
134128

135129
// Static attributes for 'dist_schedule' clause.
136130
OPENMP_DIST_SCHEDULE_KIND(static)
@@ -163,8 +157,7 @@ OPENMP_REDUCTION_MODIFIER(task)
163157
#undef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND
164158
#undef OPENMP_MAP_KIND
165159
#undef OPENMP_MAP_MODIFIER_KIND
166-
#undef OPENMP_TO_MODIFIER_KIND
167-
#undef OPENMP_FROM_MODIFIER_KIND
160+
#undef OPENMP_MOTION_MODIFIER_KIND
168161
#undef OPENMP_DIST_SCHEDULE_KIND
169162
#undef OPENMP_DEFAULTMAP_KIND
170163
#undef OPENMP_DEFAULTMAP_MODIFIER

clang/include/clang/Basic/OpenMPKinds.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,12 @@ enum OpenMPMapModifierKind {
8686
static constexpr unsigned NumberOfOMPMapClauseModifiers =
8787
OMPC_MAP_MODIFIER_last - OMPC_MAP_MODIFIER_unknown - 1;
8888

89-
/// OpenMP modifier kind for 'to' clause.
90-
enum OpenMPToModifierKind {
91-
#define OPENMP_TO_MODIFIER_KIND(Name) \
92-
OMPC_TO_MODIFIER_##Name,
89+
/// OpenMP modifier kind for 'to' or 'from' clause.
90+
enum OpenMPMotionModifierKind {
91+
#define OPENMP_MOTION_MODIFIER_KIND(Name) \
92+
OMPC_MOTION_MODIFIER_##Name,
9393
#include "clang/Basic/OpenMPKinds.def"
94-
OMPC_TO_MODIFIER_unknown
95-
};
96-
97-
/// OpenMP modifier kind for 'from' clause.
98-
enum OpenMPFromModifierKind {
99-
#define OPENMP_FROM_MODIFIER_KIND(Name) \
100-
OMPC_FROM_MODIFIER_##Name,
101-
#include "clang/Basic/OpenMPKinds.def"
102-
OMPC_FROM_MODIFIER_unknown
94+
OMPC_MOTION_MODIFIER_unknown
10395
};
10496

10597
/// OpenMP attributes for 'dist_schedule' clause.

clang/lib/AST/ASTContext.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -925,14 +925,14 @@ static const LangASMap *getAddressSpaceMap(const TargetInfo &T,
925925
2, // opencl_constant
926926
0, // opencl_private
927927
4, // opencl_generic
928-
11, // opencl_global_device
929-
12, // opencl_global_host
930-
5, // cuda_device
931-
6, // cuda_constant
932-
7, // cuda_shared
933-
8, // ptr32_sptr
934-
9, // ptr32_uptr
935-
10 // ptr64
928+
5, // opencl_global_device
929+
6, // opencl_global_host
930+
7, // cuda_device
931+
8, // cuda_constant
932+
9, // cuda_shared
933+
10, // ptr32_sptr
934+
11, // ptr32_uptr
935+
12 // ptr64
936936
};
937937
return &FakeAddrSpaceMap;
938938
} else {

clang/lib/AST/ASTImporter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,8 @@ Error ASTNodeImporter::ImportDefinition(
19061906
else
19071907
return ToCaptureOrErr.takeError();
19081908
}
1909-
cast<CXXRecordDecl>(To)->setCaptures(ToCaptures);
1909+
cast<CXXRecordDecl>(To)->setCaptures(Importer.getToContext(),
1910+
ToCaptures);
19101911
}
19111912

19121913
Error Result = ImportDeclContext(From, /*ForceImport=*/true);

clang/lib/AST/DeclCXX.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,8 @@ void CXXRecordDecl::finishedDefaultedOrDeletedMember(CXXMethodDecl *D) {
13831383
data().DeclaredNonTrivialSpecialMembers |= SMKind;
13841384
}
13851385

1386-
void CXXRecordDecl::setCaptures(ArrayRef<LambdaCapture> Captures) {
1387-
ASTContext &Context = getASTContext();
1386+
void CXXRecordDecl::setCaptures(ASTContext &Context,
1387+
ArrayRef<LambdaCapture> Captures) {
13881388
CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
13891389

13901390
// Copy captures.

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,16 +2388,16 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals, const DependentAddressSp
23882388
switch (AS) {
23892389
default: llvm_unreachable("Not a language specific address space");
23902390
// <OpenCL-addrspace> ::= "CL" [ "global" | "local" | "constant" |
2391-
// "private"| "generic" | "global_device" |
2392-
// "global_host" ]
2391+
// "private"| "generic" | "device" |
2392+
// "host" ]
23932393
case LangAS::opencl_global:
23942394
ASString = "CLglobal";
23952395
break;
23962396
case LangAS::opencl_global_device:
2397-
ASString = "CLDevice";
2397+
ASString = "CLdevice";
23982398
break;
23992399
case LangAS::opencl_global_host:
2400-
ASString = "CLHost";
2400+
ASString = "CLhost";
24012401
break;
24022402
case LangAS::opencl_local:
24032403
ASString = "CLlocal";

clang/lib/AST/MicrosoftMangle.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ void MicrosoftCXXNameMangler::mangleAddressSpaceType(QualType T,
17981798
// where:
17991799
// <language_addr_space> ::= <OpenCL-addrspace> | <CUDA-addrspace>
18001800
// <OpenCL-addrspace> ::= "CL" [ "global" | "local" | "constant" |
1801-
// "private"| "generic" ]
1801+
// "private"| "generic" | "device" | "host" ]
18021802
// <CUDA-addrspace> ::= "CU" [ "device" | "constant" | "shared" ]
18031803
// Note that the above were chosen to match the Itanium mangling for this.
18041804
//
@@ -1824,10 +1824,10 @@ void MicrosoftCXXNameMangler::mangleAddressSpaceType(QualType T,
18241824
Extra.mangleSourceName("_ASCLglobal");
18251825
break;
18261826
case LangAS::opencl_global_device:
1827-
Extra.mangleSourceName("_ASCLDevice");
1827+
Extra.mangleSourceName("_ASCLdevice");
18281828
break;
18291829
case LangAS::opencl_global_host:
1830-
Extra.mangleSourceName("_ASCLHost");
1830+
Extra.mangleSourceName("_ASCLhost");
18311831
break;
18321832
case LangAS::opencl_local:
18331833
Extra.mangleSourceName("_ASCLlocal");

0 commit comments

Comments
 (0)