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 | e01d82b81f09d840580b6ea93204c09e849ee4f8 (patch) | |
tree | 98eb716657829bfd5141ffbdc38e536762b0ec0b /clang/lib/Lex/PPDirectives.cpp | |
parent | 60ce3fe14001d8841ce0772fd0e72e47a33bd031 (diff) | |
download | bcm5719-llvm-e01d82b81f09d840580b6ea93204c09e849ee4f8.tar.gz bcm5719-llvm-e01d82b81f09d840580b6ea93204c09e849ee4f8.zip |
finish the implementation of -imacros. The driver still needs to be hooked up.
llvm-svn: 68640
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 034d484a934..ba321a7f673 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/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)); } //===----------------------------------------------------------------------===// |