Skip to content

Commit 9810b62

Browse files
committed
Merge from 'main' to 'sycl-web' (205 commits)
CONFLICT (content): Merge conflict in clang/test/Driver/amdgpu-openmp-toolchain.c
2 parents 4618e90 + 57ef29f commit 9810b62

File tree

1,178 files changed

+48735
-10793
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,178 files changed

+48735
-10793
lines changed

clang-tools-extra/CODE_OWNERS.TXT

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@ also the gatekeepers for their part of Clang, with the final word on what goes
44
in or not.
55

66
The list is sorted by surname and formatted to allow easy grepping and
7-
beautification by scripts. The fields are: name (N), email (E), web-address
8-
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
9-
(S).
7+
beautification by scripts. The fields are: name (N), email (E), Phabricator
8+
handle (H), and description (D).
109

1110
N: Aaron Ballman
1211
E: aaron@aaronballman.com
12+
H: aaron.ballman
1313
D: clang-query
1414

15-
N: Manuel Klimek
16-
E: klimek@google.com
17-
D: clang-rename, all parts of clang-tools-extra not covered by someone else
18-
19-
N: Alexander Kornienko
20-
E: alexfh@google.com
21-
D: clang-tidy
22-
2315
N: Julie Hockett
2416
E: juliehockett@google.com
2517
D: clang-doc
2618

19+
N: Nathan James
20+
E: n.james93@hotmail.co.uk
21+
H: njames93
22+
D: clang-tidy
23+
24+
N: Manuel Klimek
25+
E: klimek@google.com
26+
D: clang-rename, all parts of clang-tools-extra not covered by someone else
27+
2728
N: Sam McCall
2829
E: sammccall@google.com
2930
D: clangd

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -466,32 +466,6 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
466466
if (Server)
467467
return Reply(llvm::make_error<LSPError>("server already initialized",
468468
ErrorCode::InvalidRequest));
469-
if (Opts.UseDirBasedCDB) {
470-
DirectoryBasedGlobalCompilationDatabase::Options CDBOpts(TFS);
471-
if (const auto &Dir = Params.initializationOptions.compilationDatabasePath)
472-
CDBOpts.CompileCommandsDir = Dir;
473-
CDBOpts.ContextProvider = Opts.ContextProvider;
474-
BaseCDB =
475-
std::make_unique<DirectoryBasedGlobalCompilationDatabase>(CDBOpts);
476-
BaseCDB = getQueryDriverDatabase(llvm::makeArrayRef(Opts.QueryDriverGlobs),
477-
std::move(BaseCDB));
478-
}
479-
auto Mangler = CommandMangler::detect();
480-
if (Opts.ResourceDir)
481-
Mangler.ResourceDir = *Opts.ResourceDir;
482-
CDB.emplace(BaseCDB.get(), Params.initializationOptions.fallbackFlags,
483-
tooling::ArgumentsAdjuster(std::move(Mangler)));
484-
{
485-
// Switch caller's context with LSPServer's background context. Since we
486-
// rather want to propagate information from LSPServer's context into the
487-
// Server, CDB, etc.
488-
WithContext MainContext(BackgroundContext.clone());
489-
llvm::Optional<WithContextValue> WithOffsetEncoding;
490-
if (Opts.Encoding)
491-
WithOffsetEncoding.emplace(kCurrentOffsetEncoding, *Opts.Encoding);
492-
Server.emplace(*CDB, TFS, Opts,
493-
static_cast<ClangdServer::Callbacks *>(this));
494-
}
495469

496470
Opts.CodeComplete.EnableSnippets = Params.capabilities.CompletionSnippets;
497471
Opts.CodeComplete.IncludeFixIts = Params.capabilities.CompletionFixes;
@@ -521,6 +495,33 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
521495
BackgroundIndexSkipCreate = Params.capabilities.ImplicitProgressCreation;
522496
Opts.ImplicitCancellation = !Params.capabilities.CancelsStaleRequests;
523497

498+
if (Opts.UseDirBasedCDB) {
499+
DirectoryBasedGlobalCompilationDatabase::Options CDBOpts(TFS);
500+
if (const auto &Dir = Params.initializationOptions.compilationDatabasePath)
501+
CDBOpts.CompileCommandsDir = Dir;
502+
CDBOpts.ContextProvider = Opts.ContextProvider;
503+
BaseCDB =
504+
std::make_unique<DirectoryBasedGlobalCompilationDatabase>(CDBOpts);
505+
BaseCDB = getQueryDriverDatabase(llvm::makeArrayRef(Opts.QueryDriverGlobs),
506+
std::move(BaseCDB));
507+
}
508+
auto Mangler = CommandMangler::detect();
509+
if (Opts.ResourceDir)
510+
Mangler.ResourceDir = *Opts.ResourceDir;
511+
CDB.emplace(BaseCDB.get(), Params.initializationOptions.fallbackFlags,
512+
tooling::ArgumentsAdjuster(std::move(Mangler)));
513+
{
514+
// Switch caller's context with LSPServer's background context. Since we
515+
// rather want to propagate information from LSPServer's context into the
516+
// Server, CDB, etc.
517+
WithContext MainContext(BackgroundContext.clone());
518+
llvm::Optional<WithContextValue> WithOffsetEncoding;
519+
if (Opts.Encoding)
520+
WithOffsetEncoding.emplace(kCurrentOffsetEncoding, *Opts.Encoding);
521+
Server.emplace(*CDB, TFS, Opts,
522+
static_cast<ClangdServer::Callbacks *>(this));
523+
}
524+
524525
llvm::json::Object ServerCaps{
525526
{"textDocumentSync",
526527
llvm::json::Object{

clang-tools-extra/clangd/TUScheduler.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,16 @@ class PreambleThrottlerRequest {
390390
PreambleThrottlerRequest(llvm::StringRef Filename,
391391
PreambleThrottler *Throttler,
392392
std::condition_variable &CV)
393-
: Throttler(Throttler), Satisfied(Throttler == nullptr) {
393+
: Throttler(Throttler),
394+
Satisfied(Throttler == nullptr) {
394395
// If there is no throttler, this dummy request is always satisfied.
395396
if (!Throttler)
396397
return;
398+
Tracer.emplace("PreambleThrottled");
397399
ID = Throttler->acquire(Filename, [&] {
398400
Satisfied.store(true, std::memory_order_release);
399401
CV.notify_all();
402+
Tracer.reset();
400403
});
401404
}
402405

@@ -411,6 +414,7 @@ class PreambleThrottlerRequest {
411414
}
412415

413416
private:
417+
llvm::Optional<trace::Span> Tracer;
414418
PreambleThrottler::RequestID ID;
415419
PreambleThrottler *Throttler;
416420
std::atomic<bool> Satisfied = {false};
@@ -473,13 +477,18 @@ class PreambleThread {
473477
if (Done)
474478
break;
475479

476-
Throttle.emplace(FileName, Throttler, ReqCV);
477-
// If acquire succeeded synchronously, avoid status jitter.
478-
if (!Throttle->satisfied())
479-
Status.update([&](TUStatus &Status) {
480-
Status.PreambleActivity = PreambleAction::Queued;
481-
});
482-
ReqCV.wait(Lock, [&] { return Throttle->satisfied() || Done; });
480+
{
481+
Throttle.emplace(FileName, Throttler, ReqCV);
482+
llvm::Optional<trace::Span> Tracer;
483+
// If acquire succeeded synchronously, avoid status jitter.
484+
if (!Throttle->satisfied()) {
485+
Tracer.emplace("PreambleThrottle");
486+
Status.update([&](TUStatus &Status) {
487+
Status.PreambleActivity = PreambleAction::Queued;
488+
});
489+
}
490+
ReqCV.wait(Lock, [&] { return Throttle->satisfied() || Done; });
491+
}
483492
if (Done)
484493
break;
485494
// While waiting for the throttler, the request may have been updated!
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2+
void f() {
3+
4+
}
5+
---
6+
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument": {"foldingRange": {"lineFoldingOnly": true}}},"trace":"off"}}
7+
---
8+
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"void f() {\n\n}\n","uri":"test:///foo.cpp","version":1}}}
9+
---
10+
{"id":1,"jsonrpc":"2.0","method":"textDocument/foldingRange","params":{"textDocument":{"uri":"test:///foo.cpp"}}}
11+
# CHECK: "id": 1,
12+
# CHECK-NEXT: "jsonrpc": "2.0",
13+
# CHECK-NEXT: "result": [
14+
# CHECK-NEXT: {
15+
# CHECK-NEXT: "endLine": 1,
16+
# CHECK-NEXT: "kind": "region",
17+
# CHECK-NEXT: "startCharacter": 10,
18+
# CHECK-NEXT: "startLine": 0
19+
# CHECK-NEXT: }
20+
# CHECK-NEXT: ]
21+
---
22+
{"jsonrpc":"2.0","id":5,"method":"shutdown"}
23+
---
24+
{"jsonrpc":"2.0","method":"exit"}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ RetiredFlag<bool> AsyncPreamble("async-preamble");
307307
RetiredFlag<bool> CollectMainFileRefs("collect-main-file-refs");
308308
RetiredFlag<bool> CrossFileRename("cross-file-rename");
309309
RetiredFlag<std::string> ClangTidyChecks("clang-tidy-checks");
310-
RetiredFlag<std::string> InlayHints("inlay-hints");
311-
RetiredFlag<std::string> FoldingRanges("folding-ranges");
310+
RetiredFlag<bool> InlayHints("inlay-hints");
311+
RetiredFlag<bool> FoldingRanges("folding-ranges");
312312

313313

314314
opt<int> LimitResults{

clang/CODE_OWNERS.TXT

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)