[clang] [Clang][AST] Introduce `ExplicitInstantiationDecl` to preserve source info and fix diagnostic locations (PR #191658)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 11 13:16:42 PDT 2026
================
@@ -11065,8 +11127,19 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
: Specialization->getInstantiatedFromMemberFunction(),
D.getIdentifierLoc(), D.getCXXScopeSpec().isSet(), TSK);
- // FIXME: Create some kind of ExplicitInstantiationDecl here.
- return (Decl*) nullptr;
+ {
+ const ASTTemplateArgumentListInfo *ArgsAsWritten = nullptr;
+ if (HasExplicitTemplateArgs)
+ ArgsAsWritten =
+ ASTTemplateArgumentListInfo::Create(Context, TemplateArgs);
+ addExplicitInstantiationDecl(Context, CurContext, D.getCXXScopeSpec(),
+ D.getSourceRange().getEnd(), Specialization,
+ ExternLoc, TemplateLoc, SourceLocation(),
+ ArgsAsWritten, D.getIdentifierLoc(), T, TSK);
+ // Don't return the EID to the Parser — doing so would trigger
+ // unrelated semantic actions (e.g. access checks via FinalizeDeclaration).
+ return (Decl *)nullptr;
+ }
----------------
mizvekov wrote:
Ditto
https://github.com/llvm/llvm-project/pull/191658
More information about the cfe-commits
mailing list