diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 03:30:26 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 03:58:26 +0000 |
| commit | f5e6f11dc057d4cef59642efbcb502e002c13977 (patch) | |
| tree | e1a4f30e588554888645a5a9e526a382f5ad86c5 /include/cps | |
| parent | 8c2a2b8f9b3f495f329b2ca3c2759e076f9554fd (diff) | |
refactor(codegen): narrow FunctionGen's call and type helpers
Make getLLVMType and the link-name emitCall overload private, inline the
single-use GenerateCall helper into that overload, and drop the argument
setName calls in createArgumentAllocas that repeat the names emitPrototype
already assigned. The undefined-function diagnostic stays: a link name can
be shadowed by another module global (e.g. FUNCTION stderr).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps')
| -rw-r--r-- | include/cps/FunctionGen.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/include/cps/FunctionGen.h b/include/cps/FunctionGen.h index 7bf7eca..95579c4 100644 --- a/include/cps/FunctionGen.h +++ b/include/cps/FunctionGen.h @@ -85,6 +85,8 @@ private: std::function<void(llvm::Value *, const std::string &, int)> RegisterCopy; void createArgumentAllocas(llvm::Function *F, const std::vector<ParamDecl> &Params, bool IsMethod); + llvm::Type *getLLVMType(const std::string &TypeName); + llvm::Value *emitCall(const std::string &Callee, const std::vector<llvm::Value*> &Args); public: FunctionGen(llvm::LLVMContext &C, @@ -96,8 +98,6 @@ public: bool &HadErrorFlag, int &Line) : Context(C), Module(M), Builder(B), Types(TS), Exceptions(EH), Symbols(Sym), HadError(HadErrorFlag), DiagnosticLine(Line) {} - llvm::Type *getLLVMType(const std::string &TypeName); - void setArrayParamBinder(ArrayParamBinder Binder) { BindArrayParam = std::move(Binder); } void setCopyRegistrar(std::function<void(llvm::Value *, const std::string &, int)> Registrar) { @@ -117,7 +117,6 @@ public: llvm::Function *emitFunctionDef(FunctionDefAST *FuncAST, const std::function<void(StmtAST*)> &StmtEmitter, unsigned ScopeID); - llvm::Value *emitCall(const std::string &Callee, const std::vector<llvm::Value*> &Args); llvm::Value *emitCall(const FuncSig &Sig, const std::vector<llvm::Value*> &Args); void emitReturn(llvm::Value *RetVal); |
