From 62b605c6c0ea13e9763c0a0115464007b13a8831 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 20 Oct 2026 11:57:16 +0000 Subject: refactor(strings): replace compiler builtins with the STRING library Construct literals as STRING values and route string operations through ordinary library functions and operators. Preserve value ownership in records, arrays, constants and file I/O. Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/FileRuntimeIO.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/CodeGen/FileRuntimeIO.cc') diff --git a/lib/CodeGen/FileRuntimeIO.cc b/lib/CodeGen/FileRuntimeIO.cc index ffe5679..c23515d 100644 --- a/lib/CodeGen/FileRuntimeIO.cc +++ b/lib/CodeGen/FileRuntimeIO.cc @@ -155,6 +155,7 @@ void FileHandler::buildCloseFn() { Value *Idx = emitLookupOrFail(Name, Line); Value *Handle = Builder.CreateLoad(PtrTy, emitSlotGEP(FileHandles, PtrTy, Idx), "handle"); Builder.CreateCall(FcloseFunc, {Handle}); + Builder.CreateCall(FreeFunc, {Builder.CreateLoad(PtrTy, emitSlotGEP(FileNames, PtrTy, Idx))}); Builder.CreateStore(ConstantInt::get(I8, 0), emitSlotGEP(FileModes, I8, Idx)); Builder.CreateStore(ConstantPointerNull::get(PtrTy), emitSlotGEP(FileNames, PtrTy, Idx)); Builder.CreateStore(ConstantPointerNull::get(PtrTy), emitSlotGEP(FileHandles, PtrTy, Idx)); -- cgit v1.3.1-4-g156e