[clang] Implement `ByteAddressBuffer` Load/Store methods (PR #176058)
Kaitlin Peng via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 20 09:53:27 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:
Actually it does seem like `ParmVarDecl` is being created wrong. It's using `Method->getDeclContext()` as the declaration context when it should just be `Method`. Made that change and edited this to use `getDescribedFunctionTemplate()`
https://github.com/llvm/llvm-project/pull/176058
More information about the cfe-commits
mailing list