]> granicus.if.org Git - clang/commitdiff
move the VarargsElided member of MacrosArgs to shrink the MacroArgs struct
authorChris Lattner <sabre@nondot.org>
Mon, 14 Dec 2009 22:12:52 +0000 (22:12 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 14 Dec 2009 22:12:52 +0000 (22:12 +0000)
on 64-bit targets.  Pass Preprocessor into create/destroy methods of MacroArgs
even though it isn't used yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91345 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/MacroArgs.cpp
lib/Lex/MacroArgs.h
lib/Lex/PPMacroExpansion.cpp
lib/Lex/TokenLexer.cpp

index c14d7c438d607f5b6d1d03467845375d322c84f8..a621854814fbc4a49738f11d3da83b8bf9efce1a 100644 (file)
@@ -20,7 +20,8 @@ using namespace clang;
 /// 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 @@ MacroArgs *MacroArgs::create(const MacroInfo *MI,
 
 /// 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.
index 8dee5b3bc997bcc806ad5d0a4ddda2981b019146..43ce08c26953389af238ee60f51d8e5187541254 100644 (file)
@@ -30,6 +30,13 @@ class MacroArgs {
   /// 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 @@ class MacroArgs {
   /// 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 @@ public:
   /// 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.
index ca54236b5c7d482788d5adc206e33e40c5ac679a..dfb14ff06f1f7da186b4b1ea2997df8fd190a812 100644 (file)
@@ -204,7 +204,7 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
   // 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 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
     // "#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 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
   }
 
   return MacroArgs::create(MI, ArgTokens.data(), ArgTokens.size(),
-                           isVarargsElided);
+                           isVarargsElided, *this);
 }
 
 /// ComputeDATE_TIME - Compute the current time, enter it into the specified
index 5f70b056944a956623b90132982138ec94c7c886..a40bb62db46d5325721e3f0e3766be9629fc73d7 100644 (file)
@@ -92,7 +92,7 @@ void TokenLexer::destroy() {
   }
 
   // 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