diff options
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index a64359de06..57ab36f9f7 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -1234,11 +1234,14 @@ std::string CppWriter::getConstant(const Constant* CV, Signedness sign) { if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) { std::string S = ftostr(CFP->getValueAPF()); S = '+' + S; -// if (S.find('.') == S.npos) { TODO: do this when necessary, but it is necessary even for 0.0001 + //if (S.find('.') == S.npos) { TODO: do this when necessary, but it is necessary even for 0.0001 return S; } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { return CI->getValue().toString(10, sign == ASM_SIGNED); + } else if (isa<UndefValue>(CV)) { + return "0"; } else { + dumpIR(CV); assert(false); } } |