[clang] Implement `ByteAddressBuffer` Load/Store methods (PR #176058)
Kaitlin Peng via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 15 17:32:19 PST 2026
================
@@ -6901,8 +6901,20 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
// whose type is not instantiation dependent, do nothing to the decl
// - otherwise find its instantiated decl.
if (isa<ParmVarDecl>(D) && !ParentDependsOnArgs &&
- !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
- return D;
+ !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType()) {
+ // Check if D belongs to a function template
+ auto *PVD = cast<ParmVarDecl>(D);
+ bool IsFromFunctionTemplate =
+ llvm::any_of(ParentDC->decls(), [PVD](Decl *D) {
+ if (auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
+ return llvm::is_contained(FTD->getTemplatedDecl()->parameters(),
+ PVD);
+ return false;
+ });
----------------
kmpeng wrote:
Not sure if you're asking why we need the check in general, but we need it to stop `FindInstantiatedDecl` from returning early and not making new instantiated declarations of the parameters. You're right about being able to use getDescribedFunctionTemplate() though, thanks!
https://github.com/llvm/llvm-project/pull/176058
More information about the cfe-commits
mailing list