From bb64298ef26c9b42ae1bb50fb92b15e509b48c07 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 15 Oct 2026 08:15:05 +0800 Subject: fix(codegen): use strtoll for integer string conversion Co-Authored-By: Claude Fable 5.1 --- lib/CodeGen/StringConversionHandler.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/StringConversionHandler.cc') diff --git a/lib/CodeGen/StringConversionHandler.cc b/lib/CodeGen/StringConversionHandler.cc index 3b49cbb..6f7461c 100644 --- a/lib/CodeGen/StringConversionHandler.cc +++ b/lib/CodeGen/StringConversionHandler.cc @@ -12,8 +12,8 @@ void StringConversionHandler::setupExternalFunctions() { FunctionType *SprintfType = FunctionType::get(Type::getInt32Ty(Context), {PointerType::getUnqual(Context), PointerType::getUnqual(Context)}, true); SprintfFunc = Module.getOrInsertFunction("sprintf", SprintfType); - FunctionType *StrtolType = FunctionType::get(Type::getInt64Ty(Context), {PointerType::getUnqual(Context), PointerType::getUnqual(Context), Type::getInt32Ty(Context)}, false); - StrtolFunc = Module.getOrInsertFunction("strtol", StrtolType); + FunctionType *StrtollType = FunctionType::get(Type::getInt64Ty(Context), {PointerType::getUnqual(Context), PointerType::getUnqual(Context), Type::getInt32Ty(Context)}, false); + StrtollFunc = Module.getOrInsertFunction("strtoll", StrtollType); FunctionType *StrtodType = FunctionType::get(Type::getDoubleTy(Context), {PointerType::getUnqual(Context), PointerType::getUnqual(Context)}, false); StrtodFunc = Module.getOrInsertFunction("strtod", StrtodType); @@ -43,7 +43,7 @@ Value *StringConversionHandler::emitStrToNum(Value *Str, bool AsReal) { return Builder.CreateCall(StrtodFunc, {Str, NullPtr}, "str_to_real"); } else { Value *Base = ConstantInt::get(Type::getInt32Ty(Context), 10); - return Builder.CreateCall(StrtolFunc, {Str, NullPtr, Base}, "str_to_int"); + return Builder.CreateCall(StrtollFunc, {Str, NullPtr, Base}, "str_to_int"); } } -- cgit v1.3.1-4-g156e