From: Benjamin Kramer Date: Sat, 27 Feb 2010 16:29:36 +0000 (+0000) Subject: Another trivial getSpelling simplification. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aeb863c3b4f1b1f38a524d21570c17aa8fd9e9c9;p=clang Another trivial getSpelling simplification. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97327 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp index 6c9212632f..ede129edcb 100644 --- a/lib/Lex/PPExpressions.cpp +++ b/lib/Lex/PPExpressions.cpp @@ -170,10 +170,8 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, return true; case tok::numeric_constant: { llvm::SmallString<64> IntegerBuffer; - IntegerBuffer.resize(PeekTok.getLength()); - const char *ThisTokBegin = &IntegerBuffer[0]; - unsigned ActualLength = PP.getSpelling(PeekTok, ThisTokBegin); - NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength, + llvm::StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer); + NumericLiteralParser Literal(Spelling.begin(), Spelling.end(), PeekTok.getLocation(), PP); if (Literal.hadError) return true; // a diagnostic was already reported.