aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/PPExpressions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/PPExpressions.cpp')
-rw-r--r--lib/Lex/PPExpressions.cpp6
1 files changed, 2 insertions, 4 deletions
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.