[clang-cl, PCH] Implement support for MS-style PCH through headers

Implement support for MS-style PCH through headers.

This enables support for /Yc and /Yu where the through header is either
on the command line or included in the source. It replaces the current
support the requires the header also be specified with /FI.

This change adds a -cc1 option -pch-through-header that is used to either
start or stop compilation during PCH create or use.

When creating a PCH, the compilation ends after compilation of the through
header.

When using a PCH, tokens are skipped until after the through header is seen.

Patch By: mikerice
Differential Revision: https://reviews.llvm.org/D46652

llvm-svn: 336379
diff --git a/clang/lib/Parse/ParseAST.cpp b/clang/lib/Parse/ParseAST.cpp
index 354b380..6965060 100644
--- a/clang/lib/Parse/ParseAST.cpp
+++ b/clang/lib/Parse/ParseAST.cpp
@@ -141,6 +141,12 @@
     CleanupParser(ParseOP.get());
 
   S.getPreprocessor().EnterMainSourceFile();
+  if (!S.getPreprocessor().getCurrentLexer()) {
+    // If a PCH through header is specified that does not have an include in
+    // the source, there won't be any tokens or a Lexer.
+    return;
+  }
+
   P.Initialize();
 
   Parser::DeclGroupPtrTy ADecl;