Make the generated code for ConstantInt nicer.
authorReid Spencer <rspencer@reidspencer.com>
Wed, 11 Apr 2007 13:02:56 +0000 (13:02 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Wed, 11 Apr 2007 13:02:56 +0000 (13:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35902 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm2cpp/CppWriter.cpp

index 253375289ade61ba7c6acb85881ea5559c76a3a4..42a8560215a29c352c1a526f0ada577139a4f77c 100644 (file)
@@ -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