Add TemplateInst and drop CallCppTemplateAction (#7689)

`TemplateInst` wraps another inst. If that inst is symbolic, it is
treated as a template by `OperandDependence`.

Use this to replace `CallCppTemplateAction` with the more general
`CallAction`.
This commit is contained in:
Nicholas Bishop
2026-09-03 17:45:47 +00:00
committed by GitHub
parent 7c966c2d59
commit 27849b385c
12 changed files with 360 additions and 298 deletions
+1 -13
View File
@@ -346,22 +346,10 @@ auto PerformCallToCppTemplateName(Context& context, SemIR::LocId loc_id,
SemIR::ClangDeclId template_decl_id,
llvm::ArrayRef<SemIR::InstId> arg_ids)
-> SemIR::InstId {
auto args_id = context.inst_blocks().Add(arg_ids);
return HandleAction<SemIR::CallCppTemplateAction>(
context, loc_id, SemIR::TypeInstId::None,
{.type_id = SemIR::InstType::TypeId,
.template_decl_id = template_decl_id,
.args_id = args_id});
}
auto PerformAction(Context& context, SemIR::LocId loc_id,
SemIR::CallCppTemplateAction action) -> SemIR::InstId {
auto* template_decl = dyn_cast<clang::TemplateDecl>(
context.clang_decls().Get(action.template_decl_id).decl());
context.clang_decls().Get(template_decl_id).decl());
auto loc = GetCppLocation(context, loc_id);
auto arg_ids = context.inst_blocks().Get(action.args_id);
// Form a template argument list for this template.
clang::TemplateArgumentListInfo arg_list(loc, loc);
if (!ConvertArgsToTemplateArgs(context, template_decl, arg_ids, arg_list)) {