diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-27 15:21:59 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-27 15:21:59 -0800 |
commit | 0e55d239c3133a675a1d740f132beaa0489f689c (patch) | |
tree | 10fd25b1ce15b5873f779cb296bb1e990cbc5895 /lib/Target/CppBackend/CPPBackend.cpp | |
parent | 1702913f5f98d374ba822170d810ad2bb1afa78e (diff) |
emit 0 for undef
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); } } |