]> granicus.if.org Git - clang/commitdiff
Fixed MacroInfo definition range for function like macros with empty body.
authorAbramo Bagnara <abramo.bagnara@gmail.com>
Sat, 31 Mar 2012 20:17:27 +0000 (20:17 +0000)
committerAbramo Bagnara <abramo.bagnara@gmail.com>
Sat, 31 Mar 2012 20:17:27 +0000 (20:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153819 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Lex/Preprocessor.h
lib/Lex/PPDirectives.cpp

index fa9c417af543764956fc61b4f1d5098a20f58761..591a4498eb8dfc8d69dd5244aa2cba985474a7a9 100644 (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
index aa3d1bf66dfd2507f0e7067107009382e608fdf3..625a204af995b4790e1e6b1e471573af584ee3ab 100644 (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.