[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
Reid Spencer
reid at x10sys.com
Thu Mar 1 12:56:00 PST 2007
Changes in directory llvm/tools/llvm2cpp:
CppWriter.cpp updated: 1.41 -> 1.42
---
Log message:
Make output for ConstantInt construction correct for any bitwidth.
---
Diffs of the changes: (+2 -1)
CppWriter.cpp | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.41 llvm/tools/llvm2cpp/CppWriter.cpp:1.42
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.41 Fri Feb 16 00:34:39 2007
+++ llvm/tools/llvm2cpp/CppWriter.cpp Thu Mar 1 14:55:43 2007
@@ -665,7 +665,8 @@
}
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
Out << "ConstantInt* " << constName << " = ConstantInt::get("
- << typeName << ", " << CI->getZExtValue() << ");";
+ << "APInt(cast<IntegerTyp>(" << typeName << ")->getBitWidth(),"
+ << " \"" << CI->getValue().toStringSigned(10) << "\", 10));";
} else if (isa<ConstantAggregateZero>(CV)) {
Out << "ConstantAggregateZero* " << constName
<< " = ConstantAggregateZero::get(" << typeName << ");";
More information about the llvm-commits
mailing list