From b9b7f048b0874df0f034f6b1e15e1a4ee2131475 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 26 Jul 2026 12:12:59 +0000 Subject: refactor: centralize libc declarations, move '&' concat into StringHandler CodeGen declares its own MallocFunc in SetupExternalFunctions and uses it for char->STRING coercion and INPUT STRING buffers, removing two bare getFunction("malloc") calls that null-deref'd if no handler happened to declare malloc first. The CHR branch reuses the char->STRING coercion path instead of a second hand-rolled heap wrapper. String concatenation moves from ArithmeticHandler (which re-declared four externs per '&' and was the LLVM 19 build-pin root cause) to StringHandler::emitConcat; ArithmeticHandler no longer touches the Module. Dead FreeFunc declarations removed. Co-Authored-By: Claude Fable 5 --- AGENTS/ARCH.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'AGENTS/ARCH.md') diff --git a/AGENTS/ARCH.md b/AGENTS/ARCH.md index a23297b..cad017f 100644 --- a/AGENTS/ARCH.md +++ b/AGENTS/ARCH.md @@ -34,9 +34,10 @@ Facts about the driver (`tools/driver/main.cc`) that break naive automation: `verifyModule`, so invalid IR flips the exit code too. Check the exit code — do not grep stderr. -Build pin: **LLVM 18 only.** LLVM 19 breaks compilation (`ArithmeticHandler.cc` uses -`llvm::Module` methods relying on LLVM 18's transitive `#include`; fix would be adding -`llvm/IR/Module.h`). +Build pin: developed and tested against **LLVM 18**. (The historical LLVM 19 breakage — +`ArithmeticHandler.cc` touching `llvm::Module` through a transitive include — is gone +now that string concatenation lives in `StringHandler`, but newer LLVM versions remain +untested.) ## Layout -- cgit v1.3.1-4-g156e