[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp

Reid Spencer reid at x10sys.com
Fri Oct 20 00:08:30 PDT 2006



Changes in directory llvm/tools/llvm2cpp:

CppWriter.cpp updated: 1.16 -> 1.17
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


---
Diffs of the changes:  (+5 -6)

 CppWriter.cpp |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)


Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.16 llvm/tools/llvm2cpp/CppWriter.cpp:1.17
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.16	Thu Sep 28 18:24:48 2006
+++ llvm/tools/llvm2cpp/CppWriter.cpp	Fri Oct 20 02:07:24 2006
@@ -678,12 +678,11 @@
   if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) {
     Out << "ConstantBool* " << constName << " = ConstantBool::get(" 
         << (CB->getValue() ? "true" : "false") << ");";
-  } else if (const ConstantSInt *CI = dyn_cast<ConstantSInt>(CV)) {
-    Out << "ConstantSInt* " << constName << " = ConstantSInt::get(" 
-        << typeName << ", " << CI->getValue() << ");";
-  } else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV)) {
-    Out << "ConstantUInt* " << constName << " = ConstantUInt::get(" 
-        << typeName << ", " << CI->getValue() << ");";
+  } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
+    Out << "ConstantInt* " << constName << " = ConstantInt::get(" 
+        << typeName << ", " 
+        << (CV->getType()->isSigned() ? CI->getSExtValue() : CI->getZExtValue())
+        << ");";
   } else if (isa<ConstantAggregateZero>(CV)) {
     Out << "ConstantAggregateZero* " << constName 
         << " = ConstantAggregateZero::get(" << typeName << ");";






More information about the llvm-commits mailing list