diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-27 14:00:16 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-27 14:00:16 +0000 |
| commit | 3d7d1d7cf8685f0d9230cd89d06017869da1c6d8 (patch) | |
| tree | 3b5ea9523e94f4193eb1a28b237f41d81a2cde03 /include/cps/RuntimeCheck.h | |
| parent | a91bd145008432fb8c5d91d94ab6f50473a277f5 (diff) | |
feat(library)!: replace #LIB with __LIB source regions
Track library mode by original source line, including deferred template bodies
and automatic object cleanup. Update call lines from ordinary code and migrate
the embedded standard library to PP_DEFINE __LIB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/RuntimeCheck.h')
| -rw-r--r-- | include/cps/RuntimeCheck.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/cps/RuntimeCheck.h b/include/cps/RuntimeCheck.h index d2ee1ea..71943d4 100644 --- a/include/cps/RuntimeCheck.h +++ b/include/cps/RuntimeCheck.h @@ -3,6 +3,8 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include <cstdint> +#include <functional> +#include <utility> #include <string> namespace cps { @@ -18,7 +20,7 @@ class RuntimeCheck { llvm::FunctionCallee StderrFunc; // Windows: __acrt_iob_func(2) llvm::GlobalVariable *StderrVar; // elsewhere: the C library's stderr ExceptionHandler &Exceptions; - bool LibraryMode = false; + std::function<bool(int)> LibraryLookup; llvm::GlobalVariable *UserLine; llvm::Value *DivZeroMsg; llvm::Value *OutOfBoundsMsg; @@ -33,7 +35,7 @@ public: RuntimeCheck(llvm::Module &M, llvm::LLVMContext &C, llvm::IRBuilder<> &B, ExceptionHandler &EH); - void setLibraryMode(bool Enabled) { LibraryMode = Enabled; } + void setLibraryLookup(std::function<bool(int)> Lookup) { LibraryLookup = std::move(Lookup); } llvm::Value *lineValue(int Line); void setUserLine(int Line); |
