diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-28 06:17:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-28 06:17:16 +0000 |
commit | f5809a7b76fd5a86ae737d9b525a1eddb9339ee7 (patch) | |
tree | 4a2f95bce7d045733ee06759b8975b6a961c39fe /lib/Lex/MacroArgs.cpp | |
parent | 3521d01aed2f55b66c7ce2ad47541a9974079699 (diff) |
The PreExpArgTokens array is indexed with an argument #,
not a token number. Fix the reserve logic to get the right
amount of space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/MacroArgs.cpp')
-rw-r--r-- | lib/Lex/MacroArgs.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Lex/MacroArgs.cpp b/lib/Lex/MacroArgs.cpp index c2cf623317..4883898e3c 100644 --- a/lib/Lex/MacroArgs.cpp +++ b/lib/Lex/MacroArgs.cpp @@ -132,13 +132,14 @@ bool MacroArgs::ArgNeedsPreexpansion(const Token *ArgTok, /// getPreExpArgument - Return the pre-expanded form of the specified /// argument. const std::vector<Token> & -MacroArgs::getPreExpArgument(unsigned Arg, Preprocessor &PP) { - assert(Arg < NumUnexpArgTokens && "Invalid argument number!"); +MacroArgs::getPreExpArgument(unsigned Arg, const MacroInfo *MI, + Preprocessor &PP) { + assert(Arg < MI->getNumArgs() && "Invalid argument number!"); // If we have already computed this, return it. - if (PreExpArgTokens.empty()) - PreExpArgTokens.resize(NumUnexpArgTokens); - + if (PreExpArgTokens.size() < MI->getNumArgs()) + PreExpArgTokens.resize(MI->getNumArgs()); + std::vector<Token> &Result = PreExpArgTokens[Arg]; if (!Result.empty()) return Result; |