From 5899dd1dc362d95e23db917b387cf12e9df622ae Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 11 Apr 2007 13:02:56 +0000 Subject: Make the generated code for ConstantInt nicer. llvm-svn: 35902 --- llvm/tools/llvm2cpp/CppWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/tools/llvm2cpp/CppWriter.cpp') diff --git a/llvm/tools/llvm2cpp/CppWriter.cpp b/llvm/tools/llvm2cpp/CppWriter.cpp index 253375289ad..42a8560215a 100644 --- a/llvm/tools/llvm2cpp/CppWriter.cpp +++ b/llvm/tools/llvm2cpp/CppWriter.cpp @@ -694,8 +694,8 @@ void CppWriter::printConstant(const Constant *CV) { return; } if (const ConstantInt *CI = dyn_cast(CV)) { - Out << "ConstantInt* " << constName << " = ConstantInt::get(" - << "APInt(cast(" << typeName << ")->getBitWidth()," + Out << "ConstantInt* " << constName << " = ConstantInt::get(APInt(" + << cast(CI->getType())->getBitWidth() << ", " << " \"" << CI->getValue().toStringSigned(10) << "\", 10));"; } else if (isa(CV)) { Out << "ConstantAggregateZero* " << constName -- cgit v1.2.3