[cfe-commits] r38729 - /cfe/cfe/trunk/Lex/MacroExpander.cpp

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


Author: sabre
Date: Wed Jul 11 11:24:09 2007
New Revision: 38729

URL: http://llvm.org/viewvc/llvm-project?rev=38729&view=rev
Log:
Handle really simple expansion of ## formals.  Do not handle the empty case
yet though.

Modified:
    cfe/cfe/trunk/Lex/MacroExpander.cpp

Modified: cfe/cfe/trunk/Lex/MacroExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/MacroExpander.cpp?rev=38729&r1=38728&r2=38729&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/MacroExpander.cpp (original)
+++ cfe/cfe/trunk/Lex/MacroExpander.cpp Wed Jul 11 11:24:09 2007
@@ -246,8 +246,6 @@
   delete ActualArgs;
 }
 
-
-
 /// Expand the arguments of a function-like macro so that we can quickly
 /// return preexpanded tokens from MacroTokens.
 void MacroExpander::ExpandFunctionArguments() {
@@ -326,10 +324,21 @@
         continue;
       }
       
-      // FIXME: Handle comma swallowing GNU extension.
+      // Okay, we have a token that is either the LHS or RHS of a paste (##)
+      // argument.  It gets substituted as its non-pre-expanded tokens.
+      const std::vector<LexerToken> &ArgToks =
+        ActualArgs->getUnexpArgument(ArgNo);
+      assert(ArgToks.back().getKind() == tok::eof && "Bad argument!");
+
+      if (ArgToks.size() != 1) {  // Not just an EOF token?
+        ResultToks.insert(ResultToks.end(), ArgToks.begin(), ArgToks.end()-1);
+        continue;
+      }
       
-      // FIXME: handle pasted args.  Handle 'placemarker' stuff.
-      ResultToks.push_back(CurTok);
+      // FIXME: Handle comma swallowing GNU extension.
+      // FIXME: Handle 'placemarker' stuff.
+      assert(0 && "FIXME: handle empty arguments!");
+      //ResultToks.push_back(CurTok);
     }
   }
   





More information about the cfe-commits mailing list