[clangd] Add json::Object->Value conversion workaround for older compilers

The build was broken for clang-3.8 which we still support.
This commit is contained in:
Jan Korous 2020-03-12 15:27:08 -07:00
parent 431df3d873
commit 42b7827411
1 changed files with 12 additions and 7 deletions

View File

@ -407,7 +407,9 @@ llvm::json::Value toJSON(const WorkDoneProgressBegin &P) {
Result["cancellable"] = true;
if (P.percentage)
Result["percentage"] = 0;
return Result;
// FIXME: workaround for older gcc/clang
return std::move(Result);
}
llvm::json::Value toJSON(const WorkDoneProgressReport &P) {
@ -418,14 +420,16 @@ llvm::json::Value toJSON(const WorkDoneProgressReport &P) {
Result["message"] = *P.message;
if (P.percentage)
Result["percentage"] = *P.percentage;
return Result;
// FIXME: workaround for older gcc/clang
return std::move(Result);
}
llvm::json::Value toJSON(const WorkDoneProgressEnd &P) {
llvm::json::Object Result{{"kind", "end"}};
if (P.message)
Result["message"] = *P.message;
return Result;
// FIXME: workaround for older gcc/clang
return std::move(Result);
}
llvm::json::Value toJSON(const MessageType &R) {
@ -530,6 +534,7 @@ llvm::json::Value toJSON(const Diagnostic &D) {
Diag["source"] = D.source;
if (D.relatedInformation)
Diag["relatedInformation"] = *D.relatedInformation;
// FIXME: workaround for older gcc/clang
return std::move(Diag);
}
@ -648,8 +653,8 @@ llvm::json::Value toJSON(const SymbolDetails &P) {
if (P.ID.hasValue())
Result["id"] = P.ID.getValue().str();
// Older clang cannot compile 'return Result', even though it is legal.
return llvm::json::Value(std::move(Result));
// FIXME: workaround for older gcc/clang
return std::move(Result);
}
llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const SymbolDetails &S) {
@ -711,8 +716,8 @@ llvm::json::Value toJSON(const DocumentSymbol &S) {
Result["children"] = S.children;
if (S.deprecated)
Result["deprecated"] = true;
// Older gcc cannot compile 'return Result', even though it is legal.
return llvm::json::Value(std::move(Result));
// FIXME: workaround for older gcc/clang
return std::move(Result);
}
llvm::json::Value toJSON(const WorkspaceEdit &WE) {