aboutsummaryrefslogtreecommitdiff
path: root/include/cps/FileHandler.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 03:33:22 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 03:58:36 +0000
commit0881f6881161fc30953b872ae108e5a8d359cb5c (patch)
tree8f157814db90683fb390ea767b4f3c24e769fd7b /include/cps/FileHandler.h
parenta84128bbc1b69ab5b763d2c607b6f9f1c667802b (diff)
refactor(codegen): share the READ-mode check of file read and EOF helpers
__cps_file_read and __cps_file_eof both emitted the same mode load, comparison and ErrNotRead check after the slot lookup; emit it through FileHandler::emitRequireReadMode instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/FileHandler.h')
-rw-r--r--include/cps/FileHandler.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/cps/FileHandler.h b/include/cps/FileHandler.h
index 20ece16..fc754e8 100644
--- a/include/cps/FileHandler.h
+++ b/include/cps/FileHandler.h
@@ -54,6 +54,7 @@ class FileHandler {
llvm::Function *createHelper(const char *Name, llvm::FunctionType *FT);
llvm::Value *emitSlotGEP(llvm::GlobalVariable *Table, llvm::Type *ElemTy, llvm::Value *Idx);
llvm::Value *emitLookupOrFail(llvm::Value *Name, llvm::Value *Line);
+ void emitRequireReadMode(llvm::Value *Idx, llvm::Value *Name, llvm::Value *Line);
void buildFindFn();
void buildOpenFn();
void buildReadFn();