diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-20 11:57:16 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-20 11:57:16 +0000 |
| commit | 62b605c6c0ea13e9763c0a0115464007b13a8831 (patch) | |
| tree | 53c27965f5a365682e0d79fd96e25b228ecb9dca /include/cps/StringHandler.h | |
| parent | bfe2e75d7e3b372e55369677028429990c49bc54 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/StringHandler.h')
| -rw-r--r-- | include/cps/StringHandler.h | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/include/cps/StringHandler.h b/include/cps/StringHandler.h deleted file mode 100644 index 0b2447c..0000000 --- a/include/cps/StringHandler.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include <string> - -namespace cps { - -class StringHandler { - llvm::LLVMContext &Context; - llvm::IRBuilder<> &Builder; - llvm::Module &Module; - - llvm::FunctionCallee MallocFunc; - llvm::FunctionCallee StrLenFunc; - llvm::FunctionCallee MemCpyFunc; - llvm::FunctionCallee StrCpyFunc; - llvm::FunctionCallee StrCatFunc; - llvm::FunctionCallee StrCmpFunc; - 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); - - void setupExternalFunctions(); - llvm::Value *createLiteral(const std::string &Val); - - llvm::Value *emitLength(llvm::Value *Str); - llvm::Value *emitConcat(llvm::Value *LHS, llvm::Value *RHS); - llvm::Value *emitCompare(int Op, llvm::Value *LHS, llvm::Value *RHS); - llvm::Value *emitMid(llvm::Value *Str, llvm::Value *Start, llvm::Value *Len); - llvm::Value *emitRight(llvm::Value *Str, llvm::Value *Len); - llvm::Value *emitLeft(llvm::Value *Str, llvm::Value *Len); - llvm::Value *emitLCase(llvm::Value *Str); - llvm::Value *emitUCase(llvm::Value *Str); -}; - -} |
