diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-11-26 09:57:41 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-11-26 09:57:41 +0000 |
commit | 4174d0968044cdecb4101133593c526bcc96a076 (patch) | |
tree | 975760eda6e5d94ee2cc3b43a610f99242f0c94d | |
parent | 6e2d2a33b6be376e52688705db22534b336f5529 (diff) | |
download | bcm5719-llvm-4174d0968044cdecb4101133593c526bcc96a076.tar.gz bcm5719-llvm-4174d0968044cdecb4101133593c526bcc96a076.zip |
[clangd] Cleanup after landing documentSymbol. NFC
- fix compile error on older gcc in Protocol.cpp,
- remove redundant 'llvm::' qualifiers from Protocol.cpp,
- remove unused variables in AST.cpp
llvm-svn: 347539
-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) { |