diff options
| -rw-r--r-- | clang-tools-extra/clangd/AST.cpp | 4 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/Protocol.cpp | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp index e9cf2ffe9d1..9d4a61f77f5 100644 --- a/clang-tools-extra/clangd/AST.cpp +++ b/clang-tools-extra/clangd/AST.cpp @@ -95,11 +95,11 @@ std::string printName(const ASTContext &Ctx, const NamedDecl &ND) { return Out.str(); } // The name was empty, so present an anonymous entity. - if (auto *NS = llvm::dyn_cast<NamespaceDecl>(&ND)) + if (llvm::dyn_cast<NamespaceDecl>(&ND)) return "(anonymous namespace)"; if (auto *Cls = llvm::dyn_cast<RecordDecl>(&ND)) return ("(anonymous " + Cls->getKindName() + ")").str(); - if (auto *En = llvm::dyn_cast<EnumDecl>(&ND)) + if (llvm::dyn_cast<EnumDecl>(&ND)) return "(anonymous enum)"; return "(anonymous)"; } diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index bf32a969088..b7053eded45 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -455,11 +455,11 @@ json::Value toJSON(const CodeAction &CA) { return std::move(CodeAction); } -llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const DocumentSymbol &S) { +raw_ostream &operator<<(raw_ostream &O, const DocumentSymbol &S) { return O << S.name << " - " << toJSON(S); } -llvm::json::Value toJSON(const DocumentSymbol &S) { +json::Value toJSON(const DocumentSymbol &S) { json::Object Result{{"name", S.name}, {"kind", static_cast<int>(S.kind)}, {"range", S.range}, @@ -471,7 +471,8 @@ llvm::json::Value toJSON(const DocumentSymbol &S) { Result["children"] = S.children; if (S.deprecated) Result["deprecated"] = true; - return Result; + // Older gcc cannot compile 'return Result', even though it is legal. + return json::Value(std::move(Result)); } json::Value toJSON(const WorkspaceEdit &WE) { |

