From 0fef2986daa2945c9e3d050c0f750d56792b30bd Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 26 Jul 2026 17:13:15 +0000 Subject: refactor: groundwork for TYPE — sizeof constants, string guard, array scoping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Element sizes now flow as target-folded null-GEP sizeof constants (TypeSystem::getSizeOfConstant); the module has no DataLayout string, so host-side size math would diverge from the backend on padded structs. - Extract the triplicated STRING null->"" select into CodeGen::emitStringNullGuard. - Scope ArrayTable per function via ArrayHandler::exchangeTable, mirroring the Symbols save/clear/restore discipline. - Promote checked element addressing to public ArrayHandler::emitElementAddress for the upcoming lvalue layer. Co-Authored-By: Claude Fable 5 --- include/cps/CodeGen.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/cps/CodeGen.h') diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 43d3a32..2451cbd 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -87,6 +87,9 @@ public: llvm::Value *emitExpr(ExprAST *Expr); void emitStmt(StmtAST *Stmt); + // STRING slots zero-init to null; normalize null to "" at load/print sites. + llvm::Value *emitStringNullGuard(llvm::Value *StrVal); + const TypeInfo *resolveType(const std::string &TypeName) const; llvm::Type *getLLVMType(const std::string &TypeName) const; llvm::Value *getNamedValue(const std::string &Name) const; -- cgit v1.3.1-4-g156e