From c56877035d6600b463a9cbf0e339f7548c0b46fd Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 21 Oct 2026 05:54:26 +0000 Subject: feat(codegen): instantiate function templates by deduction Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/FunctionGen.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/FunctionGen.cc') diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc index 543bd14..c01b042 100644 --- a/lib/CodeGen/FunctionGen.cc +++ b/lib/CodeGen/FunctionGen.cc @@ -11,7 +11,7 @@ using namespace cps; // Symbols the compiler itself declares (libc + runtime); a user // FUNCTION/PROCEDURE with one of these names would hijack the runtime. -static bool isReservedRuntimeName(const std::string &Name) { +bool FunctionGen::isReservedRuntimeName(const std::string &Name) { static const char *Reserved[] = { "__cps_main", "__cps_user_line", "printf", "scanf", "malloc", "free", "strlen", "memcpy", "strcpy", "strcat", "toupper", "tolower", "sprintf", "snprintf", "strtol", "strtoll", @@ -105,12 +105,12 @@ void FunctionGen::createArgumentAllocas(Function *F, const std::vector FunctionGen::getOverloads(const std::string &Name) const { +std::vector FunctionGen::getOverloads(const std::string &Name, bool AllUnits) const { std::vector Result; auto It = Signatures.find(sameIdentifier(Name, "MAIN") ? "__cps_main" : Name); if (It != Signatures.end()) for (const FuncSig &Sig : It->second) - if (!Visible || Visible(Sig.OwnerUnit)) Result.push_back(&Sig); + if (AllUnits || !Visible || Visible(Sig.OwnerUnit)) Result.push_back(&Sig); return Result; } -- cgit v1.3.1-4-g156e