Skip to content

Commit cd8a698

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into stream_release_resources
2 parents 9941a6c + 6d34b95 commit cd8a698

File tree

1,710 files changed

+55775
-24142
lines changed

Some content is hidden

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

1,710 files changed

+55775
-24142
lines changed

buildbot/dependency.conf

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
[VERSIONS]
2-
# https://github.com/intel/llvm/releases/download/2020-WW31/oclcpuexp-2020.10.7.0.15_rel.tar.gz
3-
ocl_cpu_rt_ver=2020.10.7.0.15
4-
# https://github.com/intel/llvm/releases/download/2020-WW31/win-oclcpuexp-2020.10.7.0.15_rel.zip
5-
ocl_cpu_rt_ver_win=2020.10.7.0.15
2+
# https://github.com/intel/llvm/releases/download/2020-WW36/oclcpuexp-2020.11.8.0.27_rel.tar.gz
3+
ocl_cpu_rt_ver=2020.11.8.0.27
4+
# https://github.com/intel/llvm/releases/download/2020-WW36/win-oclcpuexp-2020.11.8.0.27_rel.zip
5+
ocl_cpu_rt_ver_win=2020.11.8.0.27
66
# Same GPU driver supports Level Zero and OpenCL:
7-
# https://github.com/intel/compute-runtime/releases/tag/20.29.17408
8-
ocl_gpu_rt_ver=20.29.17408
7+
# https://github.com/intel/compute-runtime/releases/tag/20.34.17727
8+
ocl_gpu_rt_ver=20.34.17727
99
# Same GPU driver supports Level Zero and OpenCL:
10-
# https://downloadmirror.intel.com/29674/a08/igfx_win10_100.8336.zip
11-
ocl_gpu_rt_ver_win=27.20.100.8336
10+
# https://downloadmirror.intel.com/29817/a08/igfx_win10_100.8673.zip
11+
ocl_gpu_rt_ver_win=27.20.100.8673
1212
intel_sycl_ver=build
1313
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1-beta08/oneapi-tbb-2021.1-beta08-lin.tgz
14-
tbb_ver=2021.1.8.515
14+
tbb_ver=2021.1.9.636
1515
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1-beta08/oneapi-tbb-2021.1-beta08-win.zip
16-
tbb_ver_win=2021.1.8.514
17-
# https://github.com/intel/llvm/releases/download/2020-WW31/fpgaemu-2020.10.7.0.15_rel.tar.gz
18-
ocl_fpga_emu_ver=2020.10.7.0.15
19-
# https://github.com/intel/llvm/releases/download/2020-WW31/win-fpgaemu-2020.10.7.0.15_rel.zip
20-
ocl_fpga_emu_ver_win=2020.10.7.0.15
21-
fpga_ver=20200701_000002
22-
fpga_ver_win=20200701_000002
16+
tbb_ver_win=2021.1.9.636
17+
# https://github.com/intel/llvm/releases/download/2020-WW36/fpgaemu-2020.11.8.0.27_rel.tar.gz
18+
ocl_fpga_emu_ver=2020.11.8.0.27
19+
# https://github.com/intel/llvm/releases/download/2020-WW36/win-fpgaemu-2020.11.8.0.27_rel.zip
20+
ocl_fpga_emu_ver_win=2020.11.8.0.27
21+
fpga_ver=20200811_000001
22+
fpga_ver_win=20200811_000006
2323

2424
[DRIVER VERSIONS]
25-
cpu_driver_lin=2020.10.7.0.15
26-
cpu_driver_win=2020.10.7.0.15
27-
gpu_driver_lin=20.29.17408
28-
gpu_driver_win=27.20.100.8336
29-
fpga_driver_lin=2020.10.7.0.15
30-
fpga_driver_win=2020.10.7.0.15
25+
cpu_driver_lin=2020.11.8.0.27
26+
cpu_driver_win=2020.11.8.0.27
27+
gpu_driver_lin=20.34.17727
28+
gpu_driver_win=27.20.100.8673
29+
fpga_driver_lin=2020.11.8.0.27
30+
fpga_driver_win=2020.11.8.0.27
3131
# NVidia CUDA driver
3232
# TODO provide URL for CUDA driver
3333
nvidia_gpu_driver_lin=435.21

clang-tools-extra/clang-query/tool/ClangQuery.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,31 +110,33 @@ int main(int argc, const char **argv) {
110110
ClangTool Tool(OptionsParser->getCompilations(),
111111
OptionsParser->getSourcePathList());
112112
std::vector<std::unique_ptr<ASTUnit>> ASTs;
113-
int Status = Tool.buildASTs(ASTs);
114113
int ASTStatus = 0;
115-
if (Status == 1) {
116-
// Building ASTs failed.
114+
switch (Tool.buildASTs(ASTs)) {
115+
case 0:
116+
break;
117+
case 1: // Building ASTs failed.
117118
return 1;
118-
} else if (Status == 2) {
119+
case 2:
119120
ASTStatus |= 1;
120121
llvm::errs() << "Failed to build AST for some of the files, "
121122
<< "results may be incomplete."
122123
<< "\n";
123-
} else {
124-
assert(Status == 0 && "Unexpected status returned");
124+
break;
125+
default:
126+
llvm_unreachable("Unexpected status returned");
125127
}
126128

127129
QuerySession QS(ASTs);
128130

129131
if (!Commands.empty()) {
130-
for (auto I = Commands.begin(), E = Commands.end(); I != E; ++I) {
131-
QueryRef Q = QueryParser::parse(*I, QS);
132+
for (auto &Command : Commands) {
133+
QueryRef Q = QueryParser::parse(Command, QS);
132134
if (!Q->run(llvm::outs(), QS))
133135
return 1;
134136
}
135137
} else if (!CommandFiles.empty()) {
136-
for (auto I = CommandFiles.begin(), E = CommandFiles.end(); I != E; ++I) {
137-
if (runCommandsInFile(argv[0], *I, QS))
138+
for (auto &CommandFile : CommandFiles) {
139+
if (runCommandsInFile(argv[0], CommandFile, QS))
138140
return 1;
139141
}
140142
} else {

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,10 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
592592
{"codeActionProvider", std::move(CodeActionProvider)},
593593
{"completionProvider",
594594
llvm::json::Object{
595-
{"allCommitCharacters", " \t()[]{}<>:;,+-/*%^&#?.=\"'|"},
595+
{"allCommitCharacters",
596+
{" ", "\t", "(", ")", "[", "]", "{", "}", "<",
597+
">", ":", ";", ",", "+", "-", "/", "*", "%",
598+
"^", "&", "#", "?", ".", "=", "\"", "'", "|"}},
596599
{"resolveProvider", false},
597600
// We do extra checks, e.g. that > is part of ->.
598601
{"triggerCharacters", {".", "<", ">", ":", "\"", "/"}},

clang-tools-extra/clangd/ClangdServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class ClangdServer {
131131
bool BuildRecoveryAST = true;
132132

133133
/// If true, turn on the `-frecovery-ast-type` clang flag.
134-
bool PreserveRecoveryASTType = false;
134+
bool PreserveRecoveryASTType = true;
135135

136136
/// Clangd's workspace root. Relevant for "workspace" operations not bound
137137
/// to a particular file.

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -221,23 +221,51 @@ class HighlightingsBuilder {
221221
// the end of the Tokens).
222222
TokRef = TokRef.drop_front(Conflicting.size());
223223
}
224-
// Add tokens indicating lines skipped by the preprocessor.
225-
for (const Range &R : AST.getMacros().SkippedRanges) {
224+
const auto &SM = AST.getSourceManager();
225+
StringRef MainCode = SM.getBuffer(SM.getMainFileID())->getBuffer();
226+
227+
// Merge token stream with "inactive line" markers.
228+
std::vector<HighlightingToken> WithInactiveLines;
229+
auto SortedSkippedRanges = AST.getMacros().SkippedRanges;
230+
llvm::sort(SortedSkippedRanges);
231+
auto It = NonConflicting.begin();
232+
for (const Range &R : SortedSkippedRanges) {
226233
// Create one token for each line in the skipped range, so it works
227234
// with line-based diffing.
228235
assert(R.start.line <= R.end.line);
229236
for (int Line = R.start.line; Line <= R.end.line; ++Line) {
230-
// Don't bother computing the offset for the end of the line, just use
231-
// zero. The client will treat this highlighting kind specially, and
232-
// highlight the entire line visually (i.e. not just to where the text
233-
// on the line ends, but to the end of the screen).
234-
NonConflicting.push_back({HighlightingKind::InactiveCode,
235-
{Position{Line, 0}, Position{Line, 0}}});
237+
// Copy tokens before the inactive line
238+
for (; It != NonConflicting.end() && It->R.start.line < Line; ++It)
239+
WithInactiveLines.push_back(std::move(*It));
240+
// Add a token for the inactive line itself.
241+
auto StartOfLine = positionToOffset(MainCode, Position{Line, 0});
242+
if (StartOfLine) {
243+
StringRef LineText =
244+
MainCode.drop_front(*StartOfLine).take_until([](char C) {
245+
return C == '\n';
246+
});
247+
WithInactiveLines.push_back(
248+
{HighlightingKind::InactiveCode,
249+
{Position{Line, 0},
250+
Position{Line, static_cast<int>(lspLength(LineText))}}});
251+
} else {
252+
elog("Failed to convert position to offset: {0}",
253+
StartOfLine.takeError());
254+
}
255+
256+
// Skip any other tokens on the inactive line. e.g.
257+
// `#ifndef Foo` is considered as part of an inactive region when Foo is
258+
// defined, and there is a Foo macro token.
259+
// FIXME: we should reduce the scope of the inactive region to not
260+
// include the directive itself.
261+
while (It != NonConflicting.end() && It->R.start.line == Line)
262+
++It;
236263
}
237264
}
238-
// Re-sort the tokens because that's what the diffing expects.
239-
llvm::sort(NonConflicting);
240-
return NonConflicting;
265+
// Copy tokens after the last inactive line
266+
for (; It != NonConflicting.end(); ++It)
267+
WithInactiveLines.push_back(std::move(*It));
268+
return WithInactiveLines;
241269
}
242270

243271
private:
@@ -493,9 +521,6 @@ toSemanticTokens(llvm::ArrayRef<HighlightingToken> Tokens) {
493521
std::vector<SemanticToken> Result;
494522
const HighlightingToken *Last = nullptr;
495523
for (const HighlightingToken &Tok : Tokens) {
496-
// FIXME: support inactive code - we need to provide the actual bounds.
497-
if (Tok.Kind == HighlightingKind::InactiveCode)
498-
continue;
499524
Result.emplace_back();
500525
SemanticToken &Out = Result.back();
501526
// deltaStart/deltaLine are relative if possible.

clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ class UsingFinder : public RecursiveASTVisitor<UsingFinder> {
8686
const SourceManager &SM;
8787
};
8888

89+
bool isFullyQualified(const NestedNameSpecifier *NNS) {
90+
if (!NNS)
91+
return false;
92+
return NNS->getKind() == NestedNameSpecifier::Global ||
93+
isFullyQualified(NNS->getPrefix());
94+
}
95+
8996
struct InsertionPointData {
9097
// Location to insert the "using" statement. If invalid then the statement
9198
// should not be inserted at all (it already exists).
@@ -94,6 +101,9 @@ struct InsertionPointData {
94101
// insertion point is anchored to, we may need one or more \n to ensure
95102
// proper formatting.
96103
std::string Suffix;
104+
// Whether using should be fully qualified, even if what the user typed was
105+
// not. This is based on our detection of the local style.
106+
bool AlwaysFullyQualify = false;
97107
};
98108

99109
// Finds the best place to insert the "using" statement. Returns invalid
@@ -118,7 +128,13 @@ findInsertionPoint(const Tweak::Selection &Inputs,
118128
SM)
119129
.TraverseAST(Inputs.AST->getASTContext());
120130

131+
bool AlwaysFullyQualify = true;
121132
for (auto &U : Usings) {
133+
// Only "upgrade" to fully qualified is all relevant using decls are fully
134+
// qualified. Otherwise trust what the user typed.
135+
if (!isFullyQualified(U->getQualifier()))
136+
AlwaysFullyQualify = false;
137+
122138
if (SM.isBeforeInTranslationUnit(Inputs.Cursor, U->getUsingLoc()))
123139
// "Usings" is sorted, so we're done.
124140
break;
@@ -137,6 +153,7 @@ findInsertionPoint(const Tweak::Selection &Inputs,
137153
if (LastUsingLoc.isValid()) {
138154
InsertionPointData Out;
139155
Out.Loc = LastUsingLoc;
156+
Out.AlwaysFullyQualify = AlwaysFullyQualify;
140157
return Out;
141158
}
142159

@@ -278,6 +295,9 @@ Expected<Tweak::Effect> AddUsing::apply(const Selection &Inputs) {
278295
std::string UsingText;
279296
llvm::raw_string_ostream UsingTextStream(UsingText);
280297
UsingTextStream << "using ";
298+
if (InsertionPoint->AlwaysFullyQualify &&
299+
!isFullyQualified(QualifierToRemove.getNestedNameSpecifier()))
300+
UsingTextStream << "::";
281301
QualifierToRemove.getNestedNameSpecifier()->print(
282302
UsingTextStream, Inputs.AST->getASTContext().getPrintingPolicy());
283303
UsingTextStream << Name << ";" << InsertionPoint->Suffix;

clang-tools-extra/clangd/test/initialize-params.test

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,35 @@
77
# CHECK-NEXT: "capabilities": {
88
# CHECK-NEXT: "codeActionProvider": true,
99
# CHECK-NEXT: "completionProvider": {
10-
# CHECK-NEXT: "allCommitCharacters": " \t()[]{}<>:;,+-/*%^&#?.=\"'|",
10+
# CHECK-NEXT: "allCommitCharacters": [
11+
# CHECK-NEXT: " ",
12+
# CHECK-NEXT: "\t",
13+
# CHECK-NEXT: "(",
14+
# CHECK-NEXT: ")",
15+
# CHECK-NEXT: "[",
16+
# CHECK-NEXT: "]",
17+
# CHECK-NEXT: "{",
18+
# CHECK-NEXT: "}",
19+
# CHECK-NEXT: "<",
20+
# CHECK-NEXT: ">",
21+
# CHECK-NEXT: ":",
22+
# CHECK-NEXT: ";",
23+
# CHECK-NEXT: ",",
24+
# CHECK-NEXT: "+",
25+
# CHECK-NEXT: "-",
26+
# CHECK-NEXT: "/",
27+
# CHECK-NEXT: "*",
28+
# CHECK-NEXT: "%",
29+
# CHECK-NEXT: "^",
30+
# CHECK-NEXT: "&",
31+
# CHECK-NEXT: "#",
32+
# CHECK-NEXT: "?",
33+
# CHECK-NEXT: ".",
34+
# CHECK-NEXT: "=",
35+
# CHECK-NEXT: "\"",
36+
# CHECK-NEXT: "'",
37+
# CHECK-NEXT: "|"
38+
# CHECK-NEXT: ],
1139
# CHECK-NEXT: "resolveProvider": false,
1240
# CHECK-NEXT: "triggerCharacters": [
1341
# CHECK-NEXT: ".",

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,8 @@ opt<bool> RecoveryAST{
291291
opt<bool> RecoveryASTType{
292292
"recovery-ast-type",
293293
cat(Features),
294-
desc("Preserve the type for recovery AST. Note that "
295-
"this feature is experimental and may lead to crashes"),
296-
init(false),
294+
desc("Preserve the type for recovery AST."),
295+
init(ClangdServer::Options().PreserveRecoveryASTType),
297296
Hidden,
298297
};
299298

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,11 @@ TEST(SemanticHighlighting, GetsCorrectTokens) {
503503
504504
#define $Macro[[test]]
505505
#undef $Macro[[test]]
506-
$InactiveCode[[]] #ifdef $Macro[[test]]
507-
$InactiveCode[[]] #endif
506+
$InactiveCode[[#ifdef test]]
507+
$InactiveCode[[#endif]]
508508
509-
$InactiveCode[[]] #if defined($Macro[[test]])
510-
$InactiveCode[[]] #endif
509+
$InactiveCode[[#if defined(test)]]
510+
$InactiveCode[[#endif]]
511511
)cpp",
512512
R"cpp(
513513
struct $Class[[S]] {
@@ -614,26 +614,26 @@ TEST(SemanticHighlighting, GetsCorrectTokens) {
614614
R"cpp(
615615
// Code in the preamble.
616616
// Inactive lines get an empty InactiveCode token at the beginning.
617-
$InactiveCode[[]] #ifdef $Macro[[test]]
618-
$InactiveCode[[]] #endif
617+
$InactiveCode[[#ifdef test]]
618+
$InactiveCode[[#endif]]
619619
620620
// A declaration to cause the preamble to end.
621621
int $Variable[[EndPreamble]];
622622
623623
// Code after the preamble.
624624
// Code inside inactive blocks does not get regular highlightings
625625
// because it's not part of the AST.
626-
$InactiveCode[[]] #ifdef $Macro[[test]]
627-
$InactiveCode[[]] int Inactive2;
628-
$InactiveCode[[]] #endif
626+
$InactiveCode[[#ifdef test]]
627+
$InactiveCode[[int Inactive2;]]
628+
$InactiveCode[[#endif]]
629629
630630
#ifndef $Macro[[test]]
631631
int $Variable[[Active1]];
632632
#endif
633633
634-
$InactiveCode[[]] #ifdef $Macro[[test]]
635-
$InactiveCode[[]] int Inactive3;
636-
$InactiveCode[[]] #else
634+
$InactiveCode[[#ifdef test]]
635+
$InactiveCode[[int Inactive3;]]
636+
$InactiveCode[[#else]]
637637
int $Variable[[Active2]];
638638
#endif
639639
)cpp",

0 commit comments

Comments
 (0)