mirror of
https://github.com/intel/llvm.git
synced 2026-01-23 16:06:39 +08:00
[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:
@@ -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();
|
||||
|
||||
@@ -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 {};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user