]> granicus.if.org Git - clang/commitdiff
Eliminate a completely unnecessary buffer copy when parsing float literals.
authorJohn McCall <rjmccall@apple.com>
Wed, 23 Dec 2009 01:37:10 +0000 (01:37 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 23 Dec 2009 01:37:10 +0000 (01:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91974 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/LiteralSupport.cpp

index ab669422b277f3036c7175f15f625a48754d56a8..f1993d226439cbdc262bb201ac215ce125785fd9 100644 (file)
@@ -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)