[cfe-commits] r38715 - in /cfe/cfe/trunk: Lex/IdentifierTable.cpp Lex/MacroInfo.cpp Lex/Preprocessor.cpp include/clang/Lex/IdentifierTable.h include/clang/Lex/MacroInfo.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:24:03 PDT 2007


Author: sabre
Date: Wed Jul 11 11:24:02 2007
New Revision: 38715

URL: http://llvm.org/viewvc/llvm-project?rev=38715&view=rev
Log:
Eliminate the IdentifierInfo::IsMacroArg flag.

Modified:
    cfe/cfe/trunk/Lex/IdentifierTable.cpp
    cfe/cfe/trunk/Lex/MacroInfo.cpp
    cfe/cfe/trunk/Lex/Preprocessor.cpp
    cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h
    cfe/cfe/trunk/include/clang/Lex/MacroInfo.h

Modified: cfe/cfe/trunk/Lex/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/IdentifierTable.cpp?rev=38715&r1=38714&r2=38715&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/IdentifierTable.cpp (original)
+++ cfe/cfe/trunk/Lex/IdentifierTable.cpp Wed Jul 11 11:24:02 2007
@@ -209,7 +209,6 @@
   Identifier->TokInfo.TokenID = tok::identifier;
   Identifier->TokInfo.IsExtension = false;
   Identifier->TokInfo.IsPoisoned = false;
-  Identifier->TokInfo.IsMacroArg = false;
   Identifier->TokInfo.FETokenInfo = 0;
 
   // Copy the string information.

Modified: cfe/cfe/trunk/Lex/MacroInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/MacroInfo.cpp?rev=38715&r1=38714&r2=38715&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/MacroInfo.cpp (original)
+++ cfe/cfe/trunk/Lex/MacroInfo.cpp Wed Jul 11 11:24:02 2007
@@ -26,13 +26,6 @@
   IsUsed = true;
 }
 
-/// SetIdentifierIsMacroArgFlags - Set or clear the "isMacroArg" flags on the
-/// identifiers that make up the argument list for this macro.
-void MacroInfo::SetIdentifierIsMacroArgFlags(bool Val) const {
-  for (arg_iterator I = arg_begin(), E = arg_end(); I != E; ++I)
-    (*I)->setIsMacroArg(Val);
-}
-
 /// isIdenticalTo - Return true if the specified macro definition is equal to
 /// this macro in spelling, arguments, and whitespace.  This is used to emit
 /// duplicate definition warnings.  This implements the rules in C99 6.10.3.

Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=38715&r1=38714&r2=38715&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:24:02 2007
@@ -1609,15 +1609,13 @@
 
       // If this is already used as an argument, it is used multiple times (e.g.
       // #define X(A,A.
-      if (II->isMacroArg()) {  // C99 6.10.3p6
+      if (MI->getArgumentNum(II) != -1) {  // C99 6.10.3p6
         Diag(Tok, diag::err_pp_duplicate_name_in_arg_list, II->getName());
         return true;
       }
         
       // Add the argument to the macro info.
       MI->addArgument(II);
-      // Remember it is an argument now.
-      II->setIsMacroArg(true);
       
       // Lex the token after the identifier.
       LexUnexpandedToken(Tok);
@@ -1677,8 +1675,6 @@
     // This is a function-like macro definition.  Read the argument list.
     MI->setIsFunctionLike();
     if (ReadMacroDefinitionArgList(MI)) {
-      // Clear the "isMacroArg" flags from all the macro arguments parsed.
-      MI->SetIdentifierIsMacroArgFlags(false);
       // Forget about MI.
       delete MI;
       // Throw away the rest of the line.
@@ -1720,10 +1716,9 @@
     LexUnexpandedToken(Tok);
    
     // Not a macro arg identifier?
-    if (!Tok.getIdentifierInfo() || !Tok.getIdentifierInfo()->isMacroArg()) {
+    if (!Tok.getIdentifierInfo() ||
+        MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) {
       Diag(Tok, diag::err_pp_stringize_not_parameter);
-      // Clear the "isMacroArg" flags from all the macro arguments.
-      MI->SetIdentifierIsMacroArgFlags(false);
       delete MI;
       return;
     }
@@ -1735,9 +1730,6 @@
     LexUnexpandedToken(Tok);
   }
 
-  // Clear the "isMacroArg" flags from all the macro arguments.
-  MI->SetIdentifierIsMacroArgFlags(false);
-  
   // Check that there is no paste (##) operator at the begining or end of the
   // replacement list.
   unsigned NumTokens = MI->getNumTokens();

Modified: cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h?rev=38715&r1=38714&r2=38715&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h Wed Jul 11 11:24:02 2007
@@ -34,7 +34,6 @@
   tok::TokenKind TokenID:8; // Front-end token ID or tok::identifier.
   bool IsExtension    : 1;  // True if this identifier is a language extension.
   bool IsPoisoned     : 1;  // True if this identifier is poisoned.
-  bool IsMacroArg     : 1;  // True if currently used as a macro argument.
   void *FETokenInfo;        // Managed by the language front-end.
   friend class IdentifierTable;
 public:
@@ -77,12 +76,6 @@
   /// isPoisoned - Return true if this token has been poisoned.
   bool isPoisoned() const { return IsPoisoned; }
   
-  /// IsMacroArg accessors - These indicate if the identifier is currently in
-  /// use as a macro argument identifier.  This is a transient property only
-  /// used during macro definition and expansion.
-  bool isMacroArg() const { return IsMacroArg; }
-  void setIsMacroArg(bool Val) { IsMacroArg = Val; }
-  
   /// getFETokenInfo/setFETokenInfo - The language front-end is allowed to
   /// associate arbitrary metadata with this token.
   template<typename T>

Modified: cfe/cfe/trunk/include/clang/Lex/MacroInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/MacroInfo.h?rev=38715&r1=38714&r2=38715&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/MacroInfo.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/MacroInfo.h Wed Jul 11 11:24:02 2007
@@ -169,10 +169,6 @@
     assert(!IsDisabled && "Cannot disable an already-disabled macro!");
     IsDisabled = true;
   }
-  
-  /// SetIdentifierIsMacroArgFlags - Set or clear the "isMacroArg" flags on the
-  /// identifiers that make up the argument list for this macro.
-  void SetIdentifierIsMacroArgFlags(bool Val) const;
 };
     
 }  // end namespace llvm





More information about the cfe-commits mailing list