diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-13 16:51:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-13 16:51:03 +0000 |
commit | 7c1e61d78bebdb16b029b20d701585e75ee8bf5c (patch) | |
tree | a4014a78aa8b47ea11b1ecae32f8b876b0b6b474 /clang/lib/Lex/PPLexerChange.cpp | |
parent | 9df654fa956dde2b746e0778a7c65fb3855f337b (diff) | |
download | bcm5719-llvm-7c1e61d78bebdb16b029b20d701585e75ee8bf5c.tar.gz bcm5719-llvm-7c1e61d78bebdb16b029b20d701585e75ee8bf5c.zip |
Use PushIncludeMacroStack/PopMacroStack instead of manually pushing/popping from IncludeMacroStack. This is both cleaner and makes the include stack transparently extensible.
llvm-svn: 59248
Diffstat (limited to 'clang/lib/Lex/PPLexerChange.cpp')
-rw-r--r-- | clang/lib/Lex/PPLexerChange.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp index 1ba33b58a75..99d1ca0a91f 100644 --- a/clang/lib/Lex/PPLexerChange.cpp +++ b/clang/lib/Lex/PPLexerChange.cpp @@ -86,12 +86,10 @@ void Preprocessor::EnterSourceFileWithLexer(Lexer *TheLexer, // Add the current lexer to the include stack. if (CurLexer || CurTokenLexer) - IncludeMacroStack.push_back(IncludeStackInfo(CurLexer, CurDirLookup, - CurTokenLexer)); - + PushIncludeMacroStack(); + CurLexer = TheLexer; CurDirLookup = CurDir; - CurTokenLexer = 0; // Notify the client, if desired, that we are in a new source file. if (Callbacks && !CurLexer->Is_PragmaLexer) { @@ -108,9 +106,7 @@ void Preprocessor::EnterSourceFileWithLexer(Lexer *TheLexer, /// EnterMacro - Add a Macro to the top of the include stack and start lexing /// tokens from it instead of the current buffer. void Preprocessor::EnterMacro(Token &Tok, MacroArgs *Args) { - IncludeMacroStack.push_back(IncludeStackInfo(CurLexer, CurDirLookup, - CurTokenLexer)); - CurLexer = 0; + PushIncludeMacroStack(); CurDirLookup = 0; if (NumCachedTokenLexers == 0) { @@ -137,9 +133,7 @@ void Preprocessor::EnterTokenStream(const Token *Toks, unsigned NumToks, bool DisableMacroExpansion, bool OwnsTokens) { // Save our current state. - IncludeMacroStack.push_back(IncludeStackInfo(CurLexer, CurDirLookup, - CurTokenLexer)); - CurLexer = 0; + PushIncludeMacroStack(); CurDirLookup = 0; // Create a macro expander to expand from the specified token stream. @@ -257,10 +251,8 @@ void Preprocessor::RemoveTopOfLexerStack() { } else { delete CurLexer; } - CurLexer = IncludeMacroStack.back().TheLexer; - CurDirLookup = IncludeMacroStack.back().TheDirLookup; - CurTokenLexer = IncludeMacroStack.back().TheTokenLexer; - IncludeMacroStack.pop_back(); + + PopIncludeMacroStack(); } /// HandleMicrosoftCommentPaste - When the macro expander pastes together a |