aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/ExpressionGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-21 06:00:55 +0000
committer_ov4 <ov4@ov4.org>2026-10-21 06:00:55 +0000
commitbfe020bfa91640e7a6f1a516dc752fa754249088 (patch)
treefd82055133f45fdeaacddd4e62b210f4b63e0c03 /lib/CodeGen/ExpressionGen.cc
parentc56877035d6600b463a9cbf0e339f7548c0b46fd (diff)
feat(codegen): support explicit template arguments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ExpressionGen.cc')
-rw-r--r--lib/CodeGen/ExpressionGen.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/ExpressionGen.cc b/lib/CodeGen/ExpressionGen.cc
index 15d0fe3..3377a39 100644
--- a/lib/CodeGen/ExpressionGen.cc
+++ b/lib/CodeGen/ExpressionGen.cc
@@ -150,7 +150,7 @@ Value *CodeGen::emitExpr(ExprAST *Expr) {
return emitMemberCall(Call);
if (auto *Call = dynamic_cast<CallExprAST*>(Expr))
- return emitCall(Call->getCallee(), Call->getArgs(), Call->getLine());
+ return emitCall(Call->getCallee(), Call->getArgs(), Call->getLine(), &Call->getTemplateArgs());
if (auto *D = dynamic_cast<DesignatorExprAST*>(Expr)) {
LValueInfo LV;
@@ -192,10 +192,15 @@ Value *CodeGen::emitBinaryOp(int Op, Value *L, const TypeInfo *LT,
}
Value *CodeGen::emitCall(const std::string &Callee,
- const std::vector<std::unique_ptr<ExprAST>> &ArgExprs, int Line) {
+ const std::vector<std::unique_ptr<ExprAST>> &ArgExprs, int Line,
+ const std::vector<std::string> *Explicit) {
SaveAndRestore<int> Location(DiagnosticLine, Line ? Line : DiagnosticLine);
std::string Name = Callee;
if (const BuiltinInfo *B = findBuiltin(Name)) {
+ if (Explicit && !Explicit->empty()) {
+ reportError("Explicit template arguments are not allowed on builtin %s", B->Name);
+ return nullptr;
+ }
Name = B->Name;
if (ArgExprs.size() != B->Arity) {
reportError("%s expects %u arg%s", B->Name, B->Arity, B->Arity == 1 ? "" : "s");
@@ -230,7 +235,7 @@ Value *CodeGen::emitCall(const std::string &Callee,
}
std::vector<Value*> Args;
- const FuncSig *Sig = resolveCall(Name, ArgExprs);
+ const FuncSig *Sig = resolveCall(Name, ArgExprs, Explicit);
if (!Sig || !marshalCallArgs(*Sig, ArgExprs, Line, Args)) return nullptr;
return FuncGen->emitCall(*Sig, Args);
}