Skip to content

Commit 03e2312

Browse files
committed
clangd: Fixed using correct declaration for indexing constructors
1 parent 7f4693c commit 03e2312

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

clang-tools-extra/clangd/index/SymbolCollector.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -687,19 +687,17 @@ bool SymbolCollector::handleDeclOccurrence(
687687
getRefContainer(ASTNode.Parent, Opts),
688688
isSpelled(FileLoc, *ND)});
689689
// Also collect indirect constructor calls like `make_unique`
690-
if (auto *FD = llvm::dyn_cast<clang::FunctionDecl>(D)) {
691-
if (FD->isTemplateInstantiation()) {
692-
if (auto *PT = FD->getPrimaryTemplate();
693-
PT && isLikelyForwardingFunction(PT)) {
694-
ForwardingToConstructorVisitor Visitor{};
695-
Visitor.TraverseStmt(FD->getBody());
696-
for (auto *Constructor : Visitor.Constructors) {
697-
addRef(getSymbolIDCached(Constructor),
698-
SymbolRef{FileLoc, FID, Roles,
699-
index::getSymbolInfo(ND).Kind,
700-
getRefContainer(ASTNode.Parent, Opts),
701-
isSpelled(FileLoc, *ND)});
702-
}
690+
if (auto *FD = llvm::dyn_cast<clang::FunctionDecl>(ASTNode.OrigD);
691+
FD && FD->isTemplateInstantiation()) {
692+
if (auto *PT = FD->getPrimaryTemplate();
693+
PT && isLikelyForwardingFunction(PT)) {
694+
ForwardingToConstructorVisitor Visitor{};
695+
Visitor.TraverseStmt(FD->getBody());
696+
for (auto *Constructor : Visitor.Constructors) {
697+
addRef(getSymbolIDCached(Constructor),
698+
SymbolRef{FileLoc, FID, Roles, index::getSymbolInfo(ND).Kind,
699+
getRefContainer(ASTNode.Parent, Opts),
700+
isSpelled(FileLoc, *ND)});
703701
}
704702
}
705703
}

0 commit comments

Comments
 (0)