From: Chris Lattner Date: Tue, 30 Sep 2008 20:53:45 +0000 (+0000) Subject: simplify padding, just fold it into the earlier resize. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a2990473fe999c3680a2342922c14412ded7ddf;p=clang simplify padding, just fold it into the earlier resize. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56880 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 61257187f5..fa18ce313e 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -518,18 +518,13 @@ Action::ExprResult Sema::ActOnNumericConstant(const Token &Tok) { Tok.getLocation())); } llvm::SmallString<512> IntegerBuffer; - IntegerBuffer.resize(Tok.getLength()); + // Add padding so that NumericLiteralParser can overread by one character. + IntegerBuffer.resize(Tok.getLength()+1); const char *ThisTokBegin = &IntegerBuffer[0]; // Get the spelling of the token, which eliminates trigraphs, etc. unsigned ActualLength = PP.getSpelling(Tok, ThisTokBegin); - // Add padding so that NumericLiteralParser can overread by one character. - if (!IntegerBuffer.empty()) { - IntegerBuffer.push_back(' '); - ThisTokBegin = &IntegerBuffer[0]; - } - NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength, Tok.getLocation(), PP); if (Literal.hadError)