diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
commit | abe15e553e58165e7692c0d0842865c488ed7b45 (patch) | |
tree | 1e68501209c9133fbda8d45171e59f8d6f12dd55 /lib/Lex/LiteralSupport.cpp | |
parent | 34d02d0b37f16015f317a935c48ce8b7b64ae77b (diff) |
Notes
Diffstat (limited to 'lib/Lex/LiteralSupport.cpp')
-rw-r--r-- | lib/Lex/LiteralSupport.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index ab669422b277f..9aaa82d6263ce 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -610,28 +610,14 @@ bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) { return OverflowOccurred; } -llvm::APFloat NumericLiteralParser:: -GetFloatValue(const llvm::fltSemantics &Format, bool* isExact) { +llvm::APFloat::opStatus +NumericLiteralParser::GetFloatValue(llvm::APFloat &Result) { using llvm::APFloat; using llvm::StringRef; - llvm::SmallVector<char,256> floatChars; unsigned n = std::min(SuffixBegin - ThisTokBegin, ThisTokEnd - ThisTokBegin); - for (unsigned i = 0; i != n; ++i) - floatChars.push_back(ThisTokBegin[i]); - - floatChars.push_back('\0'); - - APFloat V (Format, APFloat::fcZero, false); - APFloat::opStatus status; - - status = V.convertFromString(StringRef(&floatChars[0], n), - APFloat::rmNearestTiesToEven); - - if (isExact) - *isExact = status == APFloat::opOK; - - return V; + return Result.convertFromString(StringRef(ThisTokBegin, n), + APFloat::rmNearestTiesToEven); } |