From: John McCall Date: Wed, 23 Dec 2009 01:37:10 +0000 (+0000) Subject: Eliminate a completely unnecessary buffer copy when parsing float literals. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7e996ea794b337c9d5295455302c64dc1b0cb8d;p=clang 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 --- 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 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)