aboutsummaryrefslogtreecommitdiff
path: root/Lex
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-09-22 18:38:30 +0000
committerChris Lattner <sabre@nondot.org>2007-09-22 18:38:30 +0000
commit1c9bdaef20398390818e9114269cd9925534b89c (patch)
treea0742b64898aa641b1be96dc81219a541da0b7e0 /Lex
parent525a05093a4816af961fe2bc6b8a81c17e2e26c2 (diff)
work around bugs and missing features in apfloat.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Lex')
-rw-r--r--Lex/LiteralSupport.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lex/LiteralSupport.cpp b/Lex/LiteralSupport.cpp
index 3449c2769a..ae4c1a8fde 100644
--- a/Lex/LiteralSupport.cpp
+++ b/Lex/LiteralSupport.cpp
@@ -409,13 +409,20 @@ bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) {
return OverflowOccurred;
}
-// GetFloatValue - Poor man's floatvalue (FIXME).
llvm::APFloat NumericLiteralParser::
GetFloatValue(const llvm::fltSemantics &Format) {
char floatChars[256];
strncpy(floatChars, ThisTokBegin, ThisTokEnd-ThisTokBegin);
floatChars[ThisTokEnd-ThisTokBegin] = '\0';
+#if 0
+ // This doesn't work yet.
return llvm::APFloat(Format, floatChars);
+#else
+ // FIXME: this is horrible!
+ llvm::APFloat V(strtod(floatChars, 0));
+ V.convert(Format, llvm::APFloat::rmTowardZero);
+ return V;
+#endif
}
void NumericLiteralParser::Diag(SourceLocation Loc, unsigned DiagID,