[clang] [clang-tools-extra] clangd: Extend reference search with constructor calls through forwarding (PR #169742)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 23 00:37:15 PST 2025
================
@@ -230,6 +242,9 @@ class SymbolCollector : public index::IndexDataConsumer {
std::unique_ptr<HeaderFileURICache> HeaderFileURIs;
llvm::DenseMap<const Decl *, SymbolID> DeclToIDCache;
llvm::DenseMap<const MacroInfo *, SymbolID> MacroToIDCache;
+ llvm::DenseSet<const FunctionTemplateDecl *> LikelyForwardingFunctionCached;
----------------
timon-ul wrote:
Honestly I wasn't sure myself how useful it is and I just put it in with the expectation that we might drop it again. The idea is that for every template we call the function `isLikelyForwardingFunction` once to see if we need its body, so far so good, but then we need to call it twice for every instantiation, once to even index the body and once to then search for constructors later. This means a template with only 2 instantiations will already have 5 calls to `isLikelyForwardingFunction` on the same template, whereas this cache would get it to 1. But as you pointed out the negative case is not caught and caching that seems unrealistic.
https://github.com/llvm/llvm-project/pull/169742
More information about the cfe-commits
mailing list