From 38ff4e782ef844a21512eb2ca0e491387ae89ec5 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 05:25:09 +0000 Subject: fix: compare strings by content Co-Authored-By: Claude Fable 5.1 --- include/cps/FileHandler.h | 4 ++-- include/cps/StringHandler.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include/cps') diff --git a/include/cps/FileHandler.h b/include/cps/FileHandler.h index aaad6a0..3898a57 100644 --- a/include/cps/FileHandler.h +++ b/include/cps/FileHandler.h @@ -11,8 +11,8 @@ class RuntimeCheck; // Emits the text-file runtime: a fixed-size open-file table plus internal // __cps_file_* helper functions, synthesized once on first use so programs // without file statements keep their IR unchanged. The table is keyed by -// filename *content* (strcmp) — pseudocode STRING equality is pointer -// identity, so the same file may be named by many different buffers. +// filename *content* (strcmp), so the same file may be named by many +// different buffers. // Leaf module: methods only take and return llvm::Value*s; expression // evaluation, type coercion and the symbol table stay in CodeGen. class FileHandler { diff --git a/include/cps/StringHandler.h b/include/cps/StringHandler.h index e9a8752..0b2447c 100644 --- a/include/cps/StringHandler.h +++ b/include/cps/StringHandler.h @@ -16,6 +16,7 @@ class StringHandler { llvm::FunctionCallee MemCpyFunc; llvm::FunctionCallee StrCpyFunc; llvm::FunctionCallee StrCatFunc; + llvm::FunctionCallee StrCmpFunc; llvm::FunctionCallee ToUpperFunc; llvm::FunctionCallee ToLowerFunc; @@ -30,6 +31,7 @@ public: 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); -- cgit v1.3.1-4-g156e