Author: Jan Korous Date: 2020-03-13T14:01:33-07:00 New Revision: 42b7827411117ed78d1fc68a2b47d1057713189c
URL: https://github.com/llvm/llvm-project/commit/42b7827411117ed78d1fc68a2b47d1057713189c DIFF: https://github.com/llvm/llvm-project/commit/42b7827411117ed78d1fc68a2b47d1057713189c.diff LOG: [clangd] Add json::Object->Value conversion workaround for older compilers The build was broken for clang-3.8 which we still support. Added: Modified: clang-tools-extra/clangd/Protocol.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index 1975fc191aa1..56ddbfb446f7 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -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) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits