[clangd] Prefer definitions for gototype and implementation

Differential Revision: https://reviews.llvm.org/D133843
This commit is contained in:
Kadir Cetinkaya 2022-09-14 10:07:15 +02:00
parent be62041e7e
commit 0a093f62d1
No known key found for this signature in database
GPG Key ID: E39E36B8D2057ED6

View File

@ -1451,7 +1451,7 @@ void ClangdLSPServer::onGoToType(const TextDocumentPositionParams &Params,
return Reply(Types.takeError());
std::vector<Location> Response;
for (const LocatedSymbol &Sym : *Types)
Response.push_back(Sym.PreferredDeclaration);
Response.push_back(Sym.Definition.value_or(Sym.PreferredDeclaration));
return Reply(std::move(Response));
});
}
@ -1467,7 +1467,7 @@ void ClangdLSPServer::onGoToImplementation(
return Reply(Overrides.takeError());
std::vector<Location> Impls;
for (const LocatedSymbol &Sym : *Overrides)
Impls.push_back(Sym.PreferredDeclaration);
Impls.push_back(Sym.Definition.value_or(Sym.PreferredDeclaration));
return Reply(std::move(Impls));
});
}