diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-08 20:53:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-08 20:53:24 +0000 |
commit | fd10511b3e686c5b045f8324b0632f3624d9ef05 (patch) | |
tree | 23e247d47121d809713ac8a829f2d40135e5cd8e /lib/Lex/PPDirectives.cpp | |
parent | 0139bb96494b4c4ba0824617d5d2495dc7e44c76 (diff) |
finish the implementation of -imacros. The driver still needs to be hooked up.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPDirectives.cpp')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 034d484a93..ba321a7f67 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1050,8 +1050,7 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok, return; } - // Verify that there is nothing after the filename, other than EOM. Use the - // preprocessor to lex this in case lexing the filename entered a macro. + // Verify that there is nothing after the filename, other than EOM. CheckEndOfDirective("#include"); // Check that we don't have infinite #include recursion. @@ -1141,8 +1140,15 @@ void Preprocessor::HandleIncludeMacrosDirective(Token &IncludeMacrosTok) { return; } - // TODO: implement me :) - DiscardUntilEndOfDirective(); + // Treat this as a normal #include for checking purposes. If this is + // successful, it will push a new lexer onto the include stack. + HandleIncludeDirective(IncludeMacrosTok, 0, false); + + Token TmpTok; + do { + Lex(TmpTok); + assert(TmpTok.isNot(tok::eof) && "Didn't find end of -imacros!"); + } while (TmpTok.isNot(tok::hashhash)); } //===----------------------------------------------------------------------===// |