forked from OSchip/llvm-project
[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
This commit is contained in:
parent
6e2d2a33b6
commit
4174d09680
|
@ -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)";
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue