aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-04-11 13:02:56 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-04-11 13:02:56 +0000
commit4d26a0619dc73f5395e216b7c0e7bf855b954d1c (patch)
treed328d703667e77556c07ab6dd84516ae383434b6
parent2cd43e402a7805a9a7b45defa4f2ed1cb7e17d68 (diff)
Make the generated code for ConstantInt nicer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35902 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/llvm2cpp/CppWriter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp
index 253375289a..42a8560215 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<ConstantInt>(CV)) {
- Out << "ConstantInt* " << constName << " = ConstantInt::get("
- << "APInt(cast<IntegerType>(" << typeName << ")->getBitWidth(),"
+ Out << "ConstantInt* " << constName << " = ConstantInt::get(APInt("
+ << cast<IntegerType>(CI->getType())->getBitWidth() << ", "
<< " \"" << CI->getValue().toStringSigned(10) << "\", 10));";
} else if (isa<ConstantAggregateZero>(CV)) {
Out << "ConstantAggregateZero* " << constName