[clang] [clang-tools-extra] clangd: Extend reference search with constructor calls through forwarding (PR #169742)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 16 22:55:03 PST 2025
================
@@ -666,9 +689,19 @@ bool SymbolCollector::handleDeclOccurrence(
auto FileLoc = SM.getFileLoc(Loc);
auto FID = SM.getFileID(FileLoc);
if (Opts.RefsInHeaders || FID == SM.getMainFileID()) {
+ auto *Container = getRefContainer(ASTNode.Parent, Opts);
addRef(ID, SymbolRef{FileLoc, FID, Roles, index::getSymbolInfo(ND).Kind,
- getRefContainer(ASTNode.Parent, Opts),
- isSpelled(FileLoc, *ND)});
+ Container, isSpelled(FileLoc, *ND)});
+ // Also collect indirect constructor calls like `make_unique`
+ for (auto *Constructor : findIndirectConstructors(ASTNode.OrigD)) {
+ if (!shouldCollectSymbol(*Constructor, *ASTCtx, Opts, IsMainFileOnly))
----------------
HighCommander4 wrote:
The `IsMainFileOnly` argument needs to be computed for the constructor. See how it's computed for `ND` above; feel free to extract a lambda or something to reuse the code.
https://github.com/llvm/llvm-project/pull/169742
More information about the cfe-commits
mailing list