@@ -1140,11 +1140,21 @@ ReferencesResult findReferences(ParsedAST &AST, Position Pos, uint32_t Limit,
1140
1140
} else {
1141
1141
// Handle references to Decls.
1142
1142
1143
- // We also show references to the targets of using-decls, so we include
1144
- // DeclRelation::Underlying.
1145
- DeclRelationSet Relations = DeclRelation::TemplatePattern |
1146
- DeclRelation::Alias | DeclRelation::Underlying;
1147
- auto Decls = getDeclAtPosition (AST, *CurLoc, Relations);
1143
+ DeclRelationSet Relations =
1144
+ DeclRelation::TemplatePattern | DeclRelation::Alias;
1145
+ std::vector<const NamedDecl *> Decls =
1146
+ getDeclAtPosition (AST, *CurLoc, Relations);
1147
+ std::vector<const NamedDecl *> NonrenamingAliasUnderlyingDecls;
1148
+ // If the results include a *non-renaming* alias, get its
1149
+ // underlying decls as well. (See similar logic in locateASTReferent()).
1150
+ for (const NamedDecl *D : Decls) {
1151
+ if (llvm::isa<UsingDecl>(D) || llvm::isa<UnresolvedUsingValueDecl>(D)) {
1152
+ for (const NamedDecl *AD :
1153
+ getDeclAtPosition (AST, *CurLoc, DeclRelation::Underlying))
1154
+ NonrenamingAliasUnderlyingDecls.push_back (AD);
1155
+ }
1156
+ }
1157
+ llvm::copy (NonrenamingAliasUnderlyingDecls, std::back_inserter (Decls));
1148
1158
1149
1159
// We traverse the AST to find references in the main file.
1150
1160
auto MainFileRefs = findRefs (Decls, AST);
0 commit comments