Skip to content

Commit

Permalink
[clangd] Prefer definitions for gototype and implementation
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D133843
  • Loading branch information
kadircet committed Jul 21, 2023
1 parent be62041 commit 0a093f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang-tools-extra/clangd/ClangdLSPServer.cpp
Expand Up @@ -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));
});
}
Expand All @@ -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));
});
}
Expand Down

0 comments on commit 0a093f6

Please sign in to comment.