[clangd] Index parameters in function decls

Reviewers: hokein

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D57950

llvm-svn: 353696
This commit is contained in:
Kadir Cetinkaya
2019-02-11 13:03:08 +00:00
parent 0468fc0b8d
commit 429022995b
3 changed files with 12 additions and 0 deletions

View File

@@ -215,6 +215,7 @@ IdentifiedSymbol getSymbolAtPosition(ParsedAST &AST, SourceLocation Pos) {
IndexOpts.SystemSymbolFilter =
index::IndexingOptions::SystemSymbolFilterKind::All;
IndexOpts.IndexFunctionLocals = true;
IndexOpts.IndexParametersInDeclarations = true;
indexTopLevelDecls(AST.getASTContext(), AST.getPreprocessor(),
AST.getLocalTopLevelDecls(), DeclMacrosFinder, IndexOpts);
@@ -400,6 +401,7 @@ findRefs(const std::vector<const Decl *> &Decls, ParsedAST &AST) {
IndexOpts.SystemSymbolFilter =
index::IndexingOptions::SystemSymbolFilterKind::All;
IndexOpts.IndexFunctionLocals = true;
IndexOpts.IndexParametersInDeclarations = true;
indexTopLevelDecls(AST.getASTContext(), AST.getPreprocessor(),
AST.getLocalTopLevelDecls(), RefFinder, IndexOpts);
return std::move(RefFinder).take();

View File

@@ -301,6 +301,12 @@ TEST(SymbolInfoTests, All) {
}
)cpp",
{CreateExpectedSymbolDetails("bar", "foo::", "c:@E@foo@bar")}},
{
R"cpp( // Parameters in declarations
void foo(int ba^r);
)cpp",
{CreateExpectedSymbolDetails("bar", "foo",
"c:TestTU.cpp@50@F@foo#I#@bar")}},
{
R"cpp( // Type inferrence with auto keyword
struct foo {};

View File

@@ -86,6 +86,10 @@ TEST(HighlightsTest, All) {
auto *X = &[[foo]];
}
)cpp",
R"cpp(// Function parameter in decl
void foo(int [[^bar]]);
)cpp",
};
for (const char *Test : Tests) {
Annotations T(Test);