aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-23 01:37:10 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-23 01:37:10 +0000
commitb7e996ea794b337c9d5295455302c64dc1b0cb8d (patch)
treeb0e2366cd212a06dc254897cd9442b2ce3ca618e
parent7931c93a0a72347f0433a2a270525d3a5c61c9ba (diff)
Eliminate a completely unnecessary buffer copy when parsing float literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91974 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Lex/LiteralSupport.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp
index ab669422b2..f1993d2264 100644
--- a/lib/Lex/LiteralSupport.cpp
+++ b/lib/Lex/LiteralSupport.cpp
@@ -615,17 +615,12 @@ GetFloatValue(const llvm::fltSemantics &Format, bool* isExact) {
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),
+ status = V.convertFromString(StringRef(ThisTokBegin, n),
APFloat::rmNearestTiesToEven);
if (isExact)