summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/ClangdLSPServer.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-01-07 15:45:19 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-01-07 15:45:19 +0000
commitf2001aa74394885dc178c5997b83687acb4f55e4 (patch)
tree80666e16bbebadef8f35d1d962e09da8a7812d13 /clang-tools-extra/clangd/ClangdLSPServer.cpp
parent25d3de8a0ac4d65f2ac9820ba62a372414780649 (diff)
downloadbcm5719-llvm-f2001aa74394885dc178c5997b83687acb4f55e4.tar.gz
bcm5719-llvm-f2001aa74394885dc178c5997b83687acb4f55e4.zip
[clangd] Remove 'using namespace llvm' from .cpp files. NFC
The new guideline is to qualify with 'llvm::' explicitly both in '.h' and '.cpp' files. This simplifies moving the code between header and source files and is easier to keep consistent. llvm-svn: 350531
Diffstat (limited to 'clang-tools-extra/clangd/ClangdLSPServer.cpp')
-rw-r--r--clang-tools-extra/clangd/ClangdLSPServer.cpp190
1 files changed, 96 insertions, 94 deletions
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 08a0810d17d..e84adebac44 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -18,7 +18,6 @@
#include "llvm/Support/Path.h"
#include "llvm/Support/ScopedPrinter.h"
-using namespace llvm;
namespace clang {
namespace clangd {
namespace {
@@ -69,7 +68,7 @@ class ClangdLSPServer::MessageHandler : public Transport::MessageHandler {
public:
MessageHandler(ClangdLSPServer &Server) : Server(Server) {}
- bool onNotify(StringRef Method, json::Value Params) override {
+ bool onNotify(llvm::StringRef Method, llvm::json::Value Params) override {
log("<-- {0}", Method);
if (Method == "exit")
return false;
@@ -84,7 +83,8 @@ public:
return true;
}
- bool onCall(StringRef Method, json::Value Params, json::Value ID) override {
+ bool onCall(llvm::StringRef Method, llvm::json::Value Params,
+ llvm::json::Value ID) override {
// Calls can be canceled by the client. Add cancellation context.
WithContext WithCancel(cancelableRequestContext(ID));
trace::Span Tracer(Method);
@@ -93,22 +93,23 @@ public:
log("<-- {0}({1})", Method, ID);
if (!Server.Server && Method != "initialize") {
elog("Call {0} before initialization.", Method);
- Reply(make_error<LSPError>("server not initialized",
- ErrorCode::ServerNotInitialized));
+ Reply(llvm::make_error<LSPError>("server not initialized",
+ ErrorCode::ServerNotInitialized));
} else if (auto Handler = Calls.lookup(Method))
Handler(std::move(Params), std::move(Reply));
else
- Reply(
- make_error<LSPError>("method not found", ErrorCode::MethodNotFound));
+ Reply(llvm::make_error<LSPError>("method not found",
+ ErrorCode::MethodNotFound));
return true;
}
- bool onReply(json::Value ID, Expected<json::Value> Result) override {
+ bool onReply(llvm::json::Value ID,
+ llvm::Expected<llvm::json::Value> Result) override {
// We ignore replies, just log them.
if (Result)
log("<-- reply({0})", ID);
else
- log("<-- reply({0}) error: {1}", ID, toString(Result.takeError()));
+ log("<-- reply({0}) error: {1}", ID, llvm::toString(Result.takeError()));
return true;
}
@@ -116,15 +117,15 @@ public:
template <typename Param, typename Result>
void bind(const char *Method,
void (ClangdLSPServer::*Handler)(const Param &, Callback<Result>)) {
- Calls[Method] = [Method, Handler, this](json::Value RawParams,
+ Calls[Method] = [Method, Handler, this](llvm::json::Value RawParams,
ReplyOnce Reply) {
Param P;
if (fromJSON(RawParams, P)) {
(Server.*Handler)(P, std::move(Reply));
} else {
elog("Failed to decode {0} request.", Method);
- Reply(make_error<LSPError>("failed to decode request",
- ErrorCode::InvalidRequest));
+ Reply(llvm::make_error<LSPError>("failed to decode request",
+ ErrorCode::InvalidRequest));
}
};
}
@@ -133,7 +134,8 @@ public:
template <typename Param>
void bind(const char *Method,
void (ClangdLSPServer::*Handler)(const Param &)) {
- Notifications[Method] = [Method, Handler, this](json::Value RawParams) {
+ Notifications[Method] = [Method, Handler,
+ this](llvm::json::Value RawParams) {
Param P;
if (!fromJSON(RawParams, P)) {
elog("Failed to decode {0} request.", Method);
@@ -154,14 +156,14 @@ private:
class ReplyOnce {
std::atomic<bool> Replied = {false};
std::chrono::steady_clock::time_point Start;
- json::Value ID;
+ llvm::json::Value ID;
std::string Method;
ClangdLSPServer *Server; // Null when moved-from.
- json::Object *TraceArgs;
+ llvm::json::Object *TraceArgs;
public:
- ReplyOnce(const json::Value &ID, StringRef Method, ClangdLSPServer *Server,
- json::Object *TraceArgs)
+ ReplyOnce(const llvm::json::Value &ID, llvm::StringRef Method,
+ ClangdLSPServer *Server, llvm::json::Object *TraceArgs)
: Start(std::chrono::steady_clock::now()), ID(ID), Method(Method),
Server(Server), TraceArgs(TraceArgs) {
assert(Server);
@@ -180,12 +182,12 @@ private:
if (Server && !Replied) {
elog("No reply to message {0}({1})", Method, ID);
assert(false && "must reply to all calls!");
- (*this)(make_error<LSPError>("server failed to reply",
- ErrorCode::InternalError));
+ (*this)(llvm::make_error<LSPError>("server failed to reply",
+ ErrorCode::InternalError));
}
}
- void operator()(Expected<json::Value> Reply) {
+ void operator()(llvm::Expected<llvm::json::Value> Reply) {
assert(Server && "moved-from!");
if (Replied.exchange(true)) {
elog("Replied twice to message {0}({1})", Method, ID);
@@ -200,34 +202,34 @@ private:
std::lock_guard<std::mutex> Lock(Server->TranspWriter);
Server->Transp.reply(std::move(ID), std::move(Reply));
} else {
- Error Err = Reply.takeError();
+ llvm::Error Err = Reply.takeError();
log("--> reply:{0}({1}) {2:ms}, error: {3}", Method, ID, Duration, Err);
if (TraceArgs)
- (*TraceArgs)["Error"] = to_string(Err);
+ (*TraceArgs)["Error"] = llvm::to_string(Err);
std::lock_guard<std::mutex> Lock(Server->TranspWriter);
Server->Transp.reply(std::move(ID), std::move(Err));
}
}
};
- StringMap<std::function<void(json::Value)>> Notifications;
- StringMap<std::function<void(json::Value, ReplyOnce)>> Calls;
+ llvm::StringMap<std::function<void(llvm::json::Value)>> Notifications;
+ llvm::StringMap<std::function<void(llvm::json::Value, ReplyOnce)>> Calls;
// Method calls may be cancelled by ID, so keep track of their state.
// This needs a mutex: handlers may finish on a different thread, and that's
// when we clean up entries in the map.
mutable std::mutex RequestCancelersMutex;
- StringMap<std::pair<Canceler, /*Cookie*/ unsigned>> RequestCancelers;
+ llvm::StringMap<std::pair<Canceler, /*Cookie*/ unsigned>> RequestCancelers;
unsigned NextRequestCookie = 0; // To disambiguate reused IDs, see below.
- void onCancel(const json::Value &Params) {
- const json::Value *ID = nullptr;
+ void onCancel(const llvm::json::Value &Params) {
+ const llvm::json::Value *ID = nullptr;
if (auto *O = Params.getAsObject())
ID = O->get("id");
if (!ID) {
elog("Bad cancellation request: {0}", Params);
return;
}
- auto StrID = to_string(*ID);
+ auto StrID = llvm::to_string(*ID);
std::lock_guard<std::mutex> Lock(RequestCancelersMutex);
auto It = RequestCancelers.find(StrID);
if (It != RequestCancelers.end())
@@ -237,9 +239,9 @@ private:
// - allows cancellation using RequestCancelers[ID]
// - cleans up the entry in RequestCancelers when it's no longer needed
// If a client reuses an ID, the last wins and the first cannot be canceled.
- Context cancelableRequestContext(const json::Value &ID) {
+ Context cancelableRequestContext(const llvm::json::Value &ID) {
auto Task = cancelableTask();
- auto StrID = to_string(ID); // JSON-serialize ID for map key.
+ auto StrID = llvm::to_string(ID); // JSON-serialize ID for map key.
auto Cookie = NextRequestCookie++; // No lock, only called on main thread.
{
std::lock_guard<std::mutex> Lock(RequestCancelersMutex);
@@ -248,7 +250,7 @@ private:
// When the request ends, we can clean up the entry we just added.
// The cookie lets us check that it hasn't been overwritten due to ID
// reuse.
- return Task.first.derive(make_scope_exit([this, StrID, Cookie] {
+ return Task.first.derive(llvm::make_scope_exit([this, StrID, Cookie] {
std::lock_guard<std::mutex> Lock(RequestCancelersMutex);
auto It = RequestCancelers.find(StrID);
if (It != RequestCancelers.end() && It->second.second == Cookie)
@@ -260,7 +262,7 @@ private:
};
// call(), notify(), and reply() wrap the Transport, adding logging and locking.
-void ClangdLSPServer::call(StringRef Method, json::Value Params) {
+void ClangdLSPServer::call(llvm::StringRef Method, llvm::json::Value Params) {
auto ID = NextCallID++;
log("--> {0}({1})", Method, ID);
// We currently don't handle responses, so no need to store ID anywhere.
@@ -268,21 +270,21 @@ void ClangdLSPServer::call(StringRef Method, json::Value Params) {
Transp.call(Method, std::move(Params), ID);
}
-void ClangdLSPServer::notify(StringRef Method, json::Value Params) {
+void ClangdLSPServer::notify(llvm::StringRef Method, llvm::json::Value Params) {
log("--> {0}", Method);
std::lock_guard<std::mutex> Lock(TranspWriter);
Transp.notify(Method, std::move(Params));
}
void ClangdLSPServer::onInitialize(const InitializeParams &Params,
- Callback<json::Value> Reply) {
+ Callback<llvm::json::Value> Reply) {
if (Params.rootUri && *Params.rootUri)
ClangdServerOpts.WorkspaceRoot = Params.rootUri->file();
else if (Params.rootPath && !Params.rootPath->empty())
ClangdServerOpts.WorkspaceRoot = *Params.rootPath;
if (Server)
- return Reply(make_error<LSPError>("server already initialized",
- ErrorCode::InvalidRequest));
+ return Reply(llvm::make_error<LSPError>("server already initialized",
+ ErrorCode::InvalidRequest));
if (const auto &Dir = Params.initializationOptions.compilationDatabasePath)
CompileCommandsDir = Dir;
if (UseDirBasedCDB)
@@ -304,27 +306,27 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
SupportsHierarchicalDocumentSymbol =
Params.capabilities.HierarchicalDocumentSymbol;
SupportFileStatus = Params.initializationOptions.FileStatus;
- Reply(json::Object{
+ Reply(llvm::json::Object{
{{"capabilities",
- json::Object{
+ llvm::json::Object{
{"textDocumentSync", (int)TextDocumentSyncKind::Incremental},
{"documentFormattingProvider", true},
{"documentRangeFormattingProvider", true},
{"documentOnTypeFormattingProvider",
- json::Object{
+ llvm::json::Object{
{"firstTriggerCharacter", "}"},
{"moreTriggerCharacter", {}},
}},
{"codeActionProvider", true},
{"completionProvider",
- json::Object{
+ llvm::json::Object{
{"resolveProvider", false},
// We do extra checks for '>' and ':' in completion to only
// trigger on '->' and '::'.
{"triggerCharacters", {".", ">", ":"}},
}},
{"signatureHelpProvider",
- json::Object{
+ llvm::json::Object{
{"triggerCharacters", {"(", ","}},
}},
{"definitionProvider", true},
@@ -335,7 +337,7 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
{"workspaceSymbolProvider", true},
{"referencesProvider", true},
{"executeCommandProvider",
- json::Object{
+ llvm::json::Object{
{"commands", {ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND}},
}},
}}}});
@@ -355,8 +357,8 @@ void ClangdLSPServer::onSync(const NoParams &Params,
if (Server->blockUntilIdleForTest(/*TimeoutSeconds=*/60))
Reply(nullptr);
else
- Reply(createStringError(llvm::inconvertibleErrorCode(),
- "Not idle after a minute"));
+ Reply(llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Not idle after a minute"));
}
void ClangdLSPServer::onDocumentDidOpen(
@@ -377,7 +379,7 @@ void ClangdLSPServer::onDocumentDidChange(
: WantDiagnostics::No;
PathRef File = Params.textDocument.uri.file();
- Expected<std::string> Contents =
+ llvm::Expected<std::string> Contents =
DraftMgr.updateDraft(File, Params.contentChanges);
if (!Contents) {
// If this fails, we are most likely going to be not in sync anymore with
@@ -397,7 +399,7 @@ void ClangdLSPServer::onFileEvent(const DidChangeWatchedFilesParams &Params) {
}
void ClangdLSPServer::onCommand(const ExecuteCommandParams &Params,
- Callback<json::Value> Reply) {
+ Callback<llvm::json::Value> Reply) {
auto ApplyEdit = [&](WorkspaceEdit WE) {
ApplyWorkspaceEditParams Edit;
Edit.edit = std::move(WE);
@@ -422,8 +424,8 @@ void ClangdLSPServer::onCommand(const ExecuteCommandParams &Params,
// We should not get here because ExecuteCommandParams would not have
// parsed in the first place and this handler should not be called. But if
// more commands are added, this will be here has a safe guard.
- Reply(make_error<LSPError>(
- formatv("Unsupported command \"{0}\".", Params.command).str(),
+ Reply(llvm::make_error<LSPError>(
+ llvm::formatv("Unsupported command \"{0}\".", Params.command).str(),
ErrorCode::InvalidParams));
}
}
@@ -435,7 +437,7 @@ void ClangdLSPServer::onWorkspaceSymbol(
Params.query, CCOpts.Limit,
Bind(
[this](decltype(Reply) Reply,
- Expected<std::vector<SymbolInformation>> Items) {
+ llvm::Expected<std::vector<SymbolInformation>> Items) {
if (!Items)
return Reply(Items.takeError());
for (auto &Sym : *Items)
@@ -449,17 +451,17 @@ void ClangdLSPServer::onWorkspaceSymbol(
void ClangdLSPServer::onRename(const RenameParams &Params,
Callback<WorkspaceEdit> Reply) {
Path File = Params.textDocument.uri.file();
- Optional<std::string> Code = DraftMgr.getDraft(File);
+ llvm::Optional<std::string> Code = DraftMgr.getDraft(File);
if (!Code)
- return Reply(make_error<LSPError>("onRename called for non-added file",
- ErrorCode::InvalidParams));
+ return Reply(llvm::make_error<LSPError>(
+ "onRename called for non-added file", ErrorCode::InvalidParams));
Server->rename(
File, Params.position, Params.newName,
Bind(
- [File, Code,
- Params](decltype(Reply) Reply,
- Expected<std::vector<tooling::Replacement>> Replacements) {
+ [File, Code, Params](
+ decltype(Reply) Reply,
+ llvm::Expected<std::vector<tooling::Replacement>> Replacements) {
if (!Replacements)
return Reply(Replacements.takeError());
@@ -488,7 +490,7 @@ void ClangdLSPServer::onDocumentOnTypeFormatting(
auto File = Params.textDocument.uri.file();
auto Code = DraftMgr.getDraft(File);
if (!Code)
- return Reply(make_error<LSPError>(
+ return Reply(llvm::make_error<LSPError>(
"onDocumentOnTypeFormatting called for non-added file",
ErrorCode::InvalidParams));
@@ -505,7 +507,7 @@ void ClangdLSPServer::onDocumentRangeFormatting(
auto File = Params.textDocument.uri.file();
auto Code = DraftMgr.getDraft(File);
if (!Code)
- return Reply(make_error<LSPError>(
+ return Reply(llvm::make_error<LSPError>(
"onDocumentRangeFormatting called for non-added file",
ErrorCode::InvalidParams));
@@ -522,9 +524,9 @@ void ClangdLSPServer::onDocumentFormatting(
auto File = Params.textDocument.uri.file();
auto Code = DraftMgr.getDraft(File);
if (!Code)
- return Reply(
- make_error<LSPError>("onDocumentFormatting called for non-added file",
- ErrorCode::InvalidParams));
+ return Reply(llvm::make_error<LSPError>(
+ "onDocumentFormatting called for non-added file",
+ ErrorCode::InvalidParams));
auto ReplacementsOrError = Server->formatFile(*Code, File);
if (ReplacementsOrError)
@@ -540,8 +542,8 @@ flattenSymbolHierarchy(llvm::ArrayRef<DocumentSymbol> Symbols,
const URIForFile &FileURI) {
std::vector<SymbolInformation> Results;
- std::function<void(const DocumentSymbol &, StringRef)> Process =
- [&](const DocumentSymbol &S, Optional<StringRef> ParentName) {
+ std::function<void(const DocumentSymbol &, llvm::StringRef)> Process =
+ [&](const DocumentSymbol &S, llvm::Optional<llvm::StringRef> ParentName) {
SymbolInformation SI;
SI.containerName = ParentName ? "" : *ParentName;
SI.name = S.name;
@@ -561,13 +563,13 @@ flattenSymbolHierarchy(llvm::ArrayRef<DocumentSymbol> Symbols,
}
void ClangdLSPServer::onDocumentSymbol(const DocumentSymbolParams &Params,
- Callback<json::Value> Reply) {
+ Callback<llvm::json::Value> Reply) {
URIForFile FileURI = Params.textDocument.uri;
Server->documentSymbols(
Params.textDocument.uri.file(),
Bind(
[this, FileURI](decltype(Reply) Reply,
- Expected<std::vector<DocumentSymbol>> Items) {
+ llvm::Expected<std::vector<DocumentSymbol>> Items) {
if (!Items)
return Reply(Items.takeError());
adjustSymbolKinds(*Items, SupportedSymbolKinds);
@@ -579,7 +581,7 @@ void ClangdLSPServer::onDocumentSymbol(const DocumentSymbolParams &Params,
std::move(Reply)));
}
-static Optional<Command> asCommand(const CodeAction &Action) {
+static llvm::Optional<Command> asCommand(const CodeAction &Action) {
Command Cmd;
if (Action.command && Action.edit)
return None; // Not representable. (We never emit these anyway).
@@ -598,11 +600,11 @@ static Optional<Command> asCommand(const CodeAction &Action) {
}
void ClangdLSPServer::onCodeAction(const CodeActionParams &Params,
- Callback<json::Value> Reply) {
+ Callback<llvm::json::Value> Reply) {
auto Code = DraftMgr.getDraft(Params.textDocument.uri.file());
if (!Code)
- return Reply(make_error<LSPError>("onCodeAction called for non-added file",
- ErrorCode::InvalidParams));
+ return Reply(llvm::make_error<LSPError>(
+ "onCodeAction called for non-added file", ErrorCode::InvalidParams));
// We provide a code action for Fixes on the specified diagnostics.
std::vector<CodeAction> Actions;
for (const Diagnostic &D : Params.context.diagnostics) {
@@ -613,13 +615,13 @@ void ClangdLSPServer::onCodeAction(const CodeActionParams &Params,
}
if (SupportsCodeAction)
- Reply(json::Array(Actions));
+ Reply(llvm::json::Array(Actions));
else {
std::vector<Command> Commands;
for (const auto &Action : Actions)
if (auto Command = asCommand(Action))
Commands.push_back(std::move(*Command));
- Reply(json::Array(Commands));
+ Reply(llvm::json::Array(Commands));
}
}
@@ -627,23 +629,23 @@ void ClangdLSPServer::onCompletion(const CompletionParams &Params,
Callback<CompletionList> Reply) {
if (!shouldRunCompletion(Params))
return Reply(llvm::make_error<IgnoreCompletionError>());
- Server->codeComplete(
- Params.textDocument.uri.file(), Params.position, CCOpts,
- Bind(
- [this](decltype(Reply) Reply, Expected<CodeCompleteResult> List) {
- if (!List)
- return Reply(List.takeError());
- CompletionList LSPList;
- LSPList.isIncomplete = List->HasMore;
- for (const auto &R : List->Completions) {
- CompletionItem C = R.render(CCOpts);
- C.kind =
- adjustKindToCapability(C.kind, SupportedCompletionItemKinds);
- LSPList.items.push_back(std::move(C));
- }
- return Reply(std::move(LSPList));
- },
- std::move(Reply)));
+ Server->codeComplete(Params.textDocument.uri.file(), Params.position, CCOpts,
+ Bind(
+ [this](decltype(Reply) Reply,
+ llvm::Expected<CodeCompleteResult> List) {
+ if (!List)
+ return Reply(List.takeError());
+ CompletionList LSPList;
+ LSPList.isIncomplete = List->HasMore;
+ for (const auto &R : List->Completions) {
+ CompletionItem C = R.render(CCOpts);
+ C.kind = adjustKindToCapability(
+ C.kind, SupportedCompletionItemKinds);
+ LSPList.items.push_back(std::move(C));
+ }
+ return Reply(std::move(LSPList));
+ },
+ std::move(Reply)));
}
void ClangdLSPServer::onSignatureHelp(const TextDocumentPositionParams &Params,
@@ -660,7 +662,7 @@ void ClangdLSPServer::onGoToDefinition(const TextDocumentPositionParams &Params,
void ClangdLSPServer::onSwitchSourceHeader(const TextDocumentIdentifier &Params,
Callback<std::string> Reply) {
- Optional<Path> Result = Server->switchSourceHeader(Params.uri.file());
+ llvm::Optional<Path> Result = Server->switchSourceHeader(Params.uri.file());
Reply(Result ? URI::createFile(*Result).toString() : "");
}
@@ -672,7 +674,7 @@ void ClangdLSPServer::onDocumentHighlight(
}
void ClangdLSPServer::onHover(const TextDocumentPositionParams &Params,
- Callback<Optional<Hover>> Reply) {
+ Callback<llvm::Optional<Hover>> Reply) {
Server->findHover(Params.textDocument.uri.file(), Params.position,
std::move(Reply));
}
@@ -719,7 +721,7 @@ void ClangdLSPServer::onSymbolInfo(const TextDocumentPositionParams &Params,
ClangdLSPServer::ClangdLSPServer(class Transport &Transp,
const clangd::CodeCompleteOptions &CCOpts,
- Optional<Path> CompileCommandsDir,
+ llvm::Optional<Path> CompileCommandsDir,
bool UseDirBasedCDB,
const ClangdServer::Options &Opts)
: Transp(Transp), MsgHandler(new MessageHandler(*this)), CCOpts(CCOpts),
@@ -771,7 +773,7 @@ bool ClangdLSPServer::run() {
return CleanExit && ShutdownRequestReceived;
}
-std::vector<Fix> ClangdLSPServer::getFixes(StringRef File,
+std::vector<Fix> ClangdLSPServer::getFixes(llvm::StringRef File,
const clangd::Diagnostic &D) {
std::lock_guard<std::mutex> Lock(FixItsMutex);
auto DiagToFixItsIter = FixItsMap.find(File);
@@ -788,7 +790,7 @@ std::vector<Fix> ClangdLSPServer::getFixes(StringRef File,
bool ClangdLSPServer::shouldRunCompletion(
const CompletionParams &Params) const {
- StringRef Trigger = Params.context.triggerCharacter;
+ llvm::StringRef Trigger = Params.context.triggerCharacter;
if (Params.context.triggerKind != CompletionTriggerKind::TriggerCharacter ||
(Trigger != ">" && Trigger != ":"))
return true;
@@ -828,7 +830,7 @@ void ClangdLSPServer::onDiagnosticsReady(PathRef File,
DiagnosticToReplacementMap LocalFixIts; // Temporary storage
for (auto &Diag : Diagnostics) {
toLSPDiags(Diag, URI, DiagOpts,
- [&](clangd::Diagnostic Diag, ArrayRef<Fix> Fixes) {
+ [&](clangd::Diagnostic Diag, llvm::ArrayRef<Fix> Fixes) {
auto &FixItsForDiagnostic = LocalFixIts[Diag];
llvm::copy(Fixes, std::back_inserter(FixItsForDiagnostic));
LSPDiagnostics.push_back(std::move(Diag));
@@ -844,7 +846,7 @@ void ClangdLSPServer::onDiagnosticsReady(PathRef File,
// Publish diagnostics.
notify("textDocument/publishDiagnostics",
- json::Object{
+ llvm::json::Object{
{"uri", URI},
{"diagnostics", std::move(LSPDiagnostics)},
});
OpenPOWER on IntegriCloud