Fixed MacroInfo definition range for function like macros with empty body.

llvm-svn: 153819
This commit is contained in:
Abramo Bagnara 2012-03-31 20:17:27 +00:00
parent 77242fa79e
commit c9e48c0a3f
2 changed files with 6 additions and 6 deletions

View File

@ -1120,9 +1120,10 @@ private:
/// ReadMacroDefinitionArgList - The ( starting an argument list of a macro
/// definition has just been read. Lex the rest of the arguments and the
/// closing ), updating MI with what we learn. Return true if an error occurs
/// parsing the arg list.
bool ReadMacroDefinitionArgList(MacroInfo *MI);
/// closing ), updating MI with what we learn and saving in LastTok the
/// last token read.
/// Return true if an error occurs parsing the arg list.
bool ReadMacroDefinitionArgList(MacroInfo *MI, Token& LastTok);
/// SkipExcludedConditionalBlock - We just read a #if or related directive and
/// decided that the subsequent tokens are in the #if'd out portion of the

View File

@ -1549,10 +1549,9 @@ void Preprocessor::HandleIncludeMacrosDirective(SourceLocation HashLoc,
/// definition has just been read. Lex the rest of the arguments and the
/// closing ), updating MI with what we learn. Return true if an error occurs
/// parsing the arg list.
bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) {
bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI, Token &Tok) {
SmallVector<IdentifierInfo*, 32> Arguments;
Token Tok;
while (1) {
LexUnexpandedToken(Tok);
switch (Tok.getKind()) {
@ -1671,7 +1670,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) {
} else if (Tok.is(tok::l_paren)) {
// This is a function-like macro definition. Read the argument list.
MI->setIsFunctionLike();
if (ReadMacroDefinitionArgList(MI)) {
if (ReadMacroDefinitionArgList(MI, LastTok)) {
// Forget about MI.
ReleaseMacroInfo(MI);
// Throw away the rest of the line.