simplify padding, just fold it into the earlier resize.

llvm-svn: 56880
This commit is contained in:
Chris Lattner
2008-09-30 20:53:45 +00:00
parent 8b567f9713
commit a1cf5f9663

View File

@@ -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)