[cfe-commits] r91345 - in /cfe/trunk/lib/Lex: MacroArgs.cpp MacroArgs.h PPMacroExpansion.cpp TokenLexer.cpp

Chris Lattner sabre at nondot.org
Mon Dec 14 14:12:52 PST 2009


Author: lattner
Date: Mon Dec 14 16:12:52 2009
New Revision: 91345

URL: http://llvm.org/viewvc/llvm-project?rev=91345&view=rev
Log:
move the VarargsElided member of MacrosArgs to shrink the MacroArgs struct
on 64-bit targets.  Pass Preprocessor into create/destroy methods of MacroArgs
even though it isn't used yet.

Modified:
    cfe/trunk/lib/Lex/MacroArgs.cpp
    cfe/trunk/lib/Lex/MacroArgs.h
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp
    cfe/trunk/lib/Lex/TokenLexer.cpp

Modified: cfe/trunk/lib/Lex/MacroArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.cpp?rev=91345&r1=91344&r2=91345&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/MacroArgs.cpp (original)
+++ cfe/trunk/lib/Lex/MacroArgs.cpp Mon Dec 14 16:12:52 2009
@@ -20,7 +20,8 @@
 /// MacroArgs ctor function - This destroys the vector passed in.
 MacroArgs *MacroArgs::create(const MacroInfo *MI,
                              const Token *UnexpArgTokens,
-                             unsigned NumToks, bool VarargsElided) {
+                             unsigned NumToks, bool VarargsElided,
+                             Preprocessor &PP) {
   assert(MI->isFunctionLike() &&
          "Can't have args for an object-like macro!");
 
@@ -40,7 +41,7 @@
 
 /// destroy - Destroy and deallocate the memory for this object.
 ///
-void MacroArgs::destroy() {
+void MacroArgs::destroy(Preprocessor &PP) {
   // Run the dtor to deallocate the vectors.
   this->~MacroArgs();
   // Release the memory for the object.

Modified: cfe/trunk/lib/Lex/MacroArgs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.h?rev=91345&r1=91344&r2=91345&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/MacroArgs.h (original)
+++ cfe/trunk/lib/Lex/MacroArgs.h Mon Dec 14 16:12:52 2009
@@ -30,6 +30,13 @@
   /// concatenated together, with 'EOF' markers at the end of each argument.
   unsigned NumUnexpArgTokens;
 
+  /// VarargsElided - True if this is a C99 style varargs macro invocation and
+  /// there was no argument specified for the "..." argument.  If the argument
+  /// was specified (even empty) or this isn't a C99 style varargs function, or
+  /// if in strict mode and the C99 varargs macro had only a ... argument, this
+  /// is false.
+  bool VarargsElided;
+  
   /// PreExpArgTokens - Pre-expanded tokens for arguments that need them.  Empty
   /// if not yet computed.  This includes the EOF marker at the end of the
   /// stream.
@@ -39,13 +46,6 @@
   /// stringified form of an argument has not yet been computed, this is empty.
   std::vector<Token> StringifiedArgs;
 
-  /// VarargsElided - True if this is a C99 style varargs macro invocation and
-  /// there was no argument specified for the "..." argument.  If the argument
-  /// was specified (even empty) or this isn't a C99 style varargs function, or
-  /// if in strict mode and the C99 varargs macro had only a ... argument, this
-  /// is false.
-  bool VarargsElided;
-
   MacroArgs(unsigned NumToks, bool varargsElided)
     : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided) {}
   ~MacroArgs() {}
@@ -54,11 +54,12 @@
   /// macro and argument info.
   static MacroArgs *create(const MacroInfo *MI,
                            const Token *UnexpArgTokens,
-                           unsigned NumArgTokens, bool VarargsElided);
+                           unsigned NumArgTokens, bool VarargsElided,
+                           Preprocessor &PP);
 
   /// destroy - Destroy and deallocate the memory for this object.
   ///
-  void destroy();
+  void destroy(Preprocessor &PP);
 
   /// ArgNeedsPreexpansion - If we can prove that the argument won't be affected
   /// by pre-expansion, return false.  Otherwise, conservatively return true.

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=91345&r1=91344&r2=91345&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Mon Dec 14 16:12:52 2009
@@ -204,7 +204,7 @@
   // expansion stack, only to take it right back off.
   if (MI->getNumTokens() == 0) {
     // No need for arg info.
-    if (Args) Args->destroy();
+    if (Args) Args->destroy(*this);
 
     // Ignore this macro use, just return the next token in the current
     // buffer.
@@ -232,7 +232,7 @@
     // "#define VAL 42".
 
     // No need for arg info.
-    if (Args) Args->destroy();
+    if (Args) Args->destroy(*this);
 
     // Propagate the isAtStartOfLine/hasLeadingSpace markers of the macro
     // identifier to the expanded token.
@@ -446,7 +446,7 @@
   }
 
   return MacroArgs::create(MI, ArgTokens.data(), ArgTokens.size(),
-                           isVarargsElided);
+                           isVarargsElided, *this);
 }
 
 /// ComputeDATE_TIME - Compute the current time, enter it into the specified

Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=91345&r1=91344&r2=91345&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Mon Dec 14 16:12:52 2009
@@ -92,7 +92,7 @@
   }
 
   // TokenLexer owns its formal arguments.
-  if (ActualArgs) ActualArgs->destroy();
+  if (ActualArgs) ActualArgs->destroy(PP);
 }
 
 /// Expand the arguments of a function-like macro so that we can quickly





More information about the cfe-commits mailing list