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.
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));
}
//===----------------------------------------------------------------------===//
Buf.insert(Buf.end(), EscapedFile.begin(), EscapedFile.end());
Buf.push_back('"');
Buf.push_back('\n');
+ // Marker token to stop the __include_macros fetch loop.
+ const char *Marker = "##\n"; // ##?
+ Buf.insert(Buf.end(), Marker, Marker+strlen(Marker));
}
/// AddImplicitIncludePTH - Add an implicit #include using the original file