[cfe-commits] r91974 - /cfe/trunk/lib/Lex/LiteralSupport.cpp

John McCall rjmccall at apple.com
Tue Dec 22 17:37:11 PST 2009


Author: rjmccall
Date: Tue Dec 22 19:37:10 2009
New Revision: 91974

URL: http://llvm.org/viewvc/llvm-project?rev=91974&view=rev
Log:
Eliminate a completely unnecessary buffer copy when parsing float literals.


Modified:
    cfe/trunk/lib/Lex/LiteralSupport.cpp

Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=91974&r1=91973&r2=91974&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Dec 22 19:37:10 2009
@@ -615,17 +615,12 @@
   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)





More information about the cfe-commits mailing list