Author: ibiryukov Date: Mon Nov 26 01:57:41 2018 New Revision: 347539 URL: http://llvm.org/viewvc/llvm-project?rev=347539&view=rev Log: [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 Modified: clang-tools-extra/trunk/clangd/AST.cpp clang-tools-extra/trunk/clangd/Protocol.cpp Modified: clang-tools-extra/trunk/clangd/AST.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/AST.cpp?rev=347539&r1=347538&r2=347539&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/AST.cpp (original) +++ clang-tools-extra/trunk/clangd/AST.cpp Mon Nov 26 01:57:41 2018 @@ -95,11 +95,11 @@ std::string printName(const ASTContext & 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)"; } Modified: clang-tools-extra/trunk/clangd/Protocol.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.cpp?rev=347539&r1=347538&r2=347539&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/Protocol.cpp (original) +++ clang-tools-extra/trunk/clangd/Protocol.cpp Mon Nov 26 01:57:41 2018 @@ -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 DocumentS 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) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits