From 4d26a0619dc73f5395e216b7c0e7bf855b954d1c Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 11 Apr 2007 13:02:56 +0000 Subject: [PATCH] Make the generated code for ConstantInt nicer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35902 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm2cpp/CppWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp index 253375289ad..42a8560215a 100644 --- a/tools/llvm2cpp/CppWriter.cpp +++ b/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 -- 2.34.1