[clang] [Clang] Refactor instantiation of declarations within concepts (PR #221707)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 11 01:43:41 PDT 2026
================
@@ -1996,11 +1989,41 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) {
return SemaRef.FindInstantiatedDecl(Loc, cast<NamedDecl>(D), TemplateArgs);
}
-bool TemplateInstantiator::maybeInstantiateFunctionParameterToScope(
- ParmVarDecl *OldParm) {
- if (SemaRef.CurrentInstantiationScope->getInstantiationOfIfExists(OldParm))
+bool TemplateInstantiator::instantiateMissingDeclsToScopeForConcepts(Decl *PD) {
+ if (!(PD && (SemaRef.inConstraintSubstitution() ||
+ SemaRef.inParameterMappingSubstitution())))
+ return false;
+
+ auto *Current = SemaRef.CurrentInstantiationScope;
+ if (!Current)
+ return false;
----------------
zyn0217 wrote:
Hmm actually in parameter mapping we cannot have one: we want to leave them unsubstituted, and a null Scope instructs FindInstantiatedDecl for that.
And we check if (SemaRef.CurrentInstantiationScope) in previous, so I think this is harmless.
https://github.com/llvm/llvm-project/pull/221707
More information about the cfe-commits
mailing list