summaryrefslogtreecommitdiffstats
path: root/clang/Lex/MacroExpander.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-19 03:51:26 +0000
committerChris Lattner <sabre@nondot.org>2006-07-19 03:51:26 +0000
commit7e2e669080897c38308b8049a16787f5d0f6e975 (patch)
tree315c91b9e0e84f880948b58345d3cee3bde963ca /clang/Lex/MacroExpander.cpp
parent81500bc3ae9601f6e52b0ee1404fa3c766e4840d (diff)
downloadbcm5719-llvm-7e2e669080897c38308b8049a16787f5d0f6e975.tar.gz
bcm5719-llvm-7e2e669080897c38308b8049a16787f5d0f6e975.zip
Handle really simple expansion of ## formals. Do not handle the empty case
yet though. llvm-svn: 38729
Diffstat (limited to 'clang/Lex/MacroExpander.cpp')
-rw-r--r--clang/Lex/MacroExpander.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/clang/Lex/MacroExpander.cpp b/clang/Lex/MacroExpander.cpp
index c09c2d9600f..0564cbe2a6e 100644
--- a/clang/Lex/MacroExpander.cpp
+++ b/clang/Lex/MacroExpander.cpp
@@ -246,8 +246,6 @@ MacroExpander::~MacroExpander() {
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 @@ void MacroExpander::ExpandFunctionArguments() {
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);
}
}
OpenPOWER on IntegriCloud