diff options
| author | _ov4 <ov4@ov4.org> | 2026-07-26 12:17:20 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-07-26 12:17:20 +0000 |
| commit | 9164871fe4982bdd12866eb28ebded68ca3dacd1 (patch) | |
| tree | 7cfd061e731958071f833d0a8932cc45c51ad455 /include/cps | |
| parent | 1749b2b4a3e55db7c9bed95376f99b7f07932b49 (diff) | |
refactor: dedupe StringHandler case-convert and substring-copy code
emitLCase/emitUCase were a 45-line verbatim pair differing only in the
libc callee; both now delegate to emitCaseConvert(Str, CaseFn). The
malloc+memcpy+NUL tail duplicated across emitMid/emitRight/emitLeft
moves into allocCopySubstring; each function keeps its own clamp logic,
which is intentionally different.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps')
| -rw-r--r-- | include/cps/StringHandler.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/cps/StringHandler.h b/include/cps/StringHandler.h index 0af0cc7..e9a8752 100644 --- a/include/cps/StringHandler.h +++ b/include/cps/StringHandler.h @@ -19,6 +19,9 @@ class StringHandler { llvm::FunctionCallee ToUpperFunc; llvm::FunctionCallee ToLowerFunc; + llvm::Value *emitCaseConvert(llvm::Value *Str, llvm::FunctionCallee CaseFn); + llvm::Value *allocCopySubstring(llvm::Value *Src, llvm::Value *StartIdx, llvm::Value *Len); + public: StringHandler(llvm::LLVMContext &Ctx, llvm::IRBuilder<> &B, llvm::Module &M); |
