[llvm-commits] [llvm] r57110 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
Anton Korobeynikov
asl at math.spbu.ru
Sun Oct 5 08:07:06 PDT 2008
Author: asl
Date: Sun Oct 5 10:07:06 2008
New Revision: 57110
URL: http://llvm.org/viewvc/llvm-project?rev=57110&view=rev
Log:
Emit type-correct constant null. Also fix a typo.
Patch by Robert G. Jakabosky!
Modified:
llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=57110&r1=57109&r2=57110&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Sun Oct 5 10:07:06 2008
@@ -722,16 +722,12 @@
std::string constName(getCppName(CV));
std::string typeName(getCppName(CV->getType()));
- if (CV->isNullValue()) {
- Out << "Constant* " << constName << " = Constant::getNullValue("
- << typeName << ");";
- nl(Out);
- return;
- }
+
if (isa<GlobalValue>(CV)) {
// Skip variables and functions, we emit them elsewhere
return;
}
+
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
std::string constValue = CI->getValue().toString(10, true);
Out << "ConstantInt* " << constName << " = ConstantInt::get(APInt("
@@ -742,7 +738,7 @@
<< " = ConstantAggregateZero::get(" << typeName << ");";
} else if (isa<ConstantPointerNull>(CV)) {
Out << "ConstantPointerNull* " << constName
- << " = ConstanPointerNull::get(" << typeName << ");";
+ << " = ConstantPointerNull::get(" << typeName << ");";
} else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
Out << "ConstantFP* " << constName << " = ";
printCFP(CFP);
More information about the llvm-commits
mailing list