diff options
author | Erich Keane <erich.keane@intel.com> | 2018-07-05 17:22:13 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-07-05 17:22:13 +0000 |
commit | 76675de15cfc0912cb1b3520ec59768d96d501d2 (patch) | |
tree | aae9ab01ade7645e1ab82c66a7d0aebf0deeca33 /clang/lib/Serialization/ASTReader.cpp | |
parent | a8db71f06fd9cd37ebcf154efe38b0e2d4e4034b (diff) | |
download | bcm5719-llvm-76675de15cfc0912cb1b3520ec59768d96d501d2.tar.gz bcm5719-llvm-76675de15cfc0912cb1b3520ec59768d96d501d2.zip |
[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
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index f56afeb8923..84286ca3808 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -704,6 +704,17 @@ static bool checkPreprocessorOptions(const PreprocessorOptions &PPOpts, // Compute the #include and #include_macros lines we need. for (unsigned I = 0, N = ExistingPPOpts.Includes.size(); I != N; ++I) { StringRef File = ExistingPPOpts.Includes[I]; + + if (!ExistingPPOpts.ImplicitPCHInclude.empty() && + !ExistingPPOpts.PCHThroughHeader.empty()) { + // In case the through header is an include, we must add all the includes + // to the predefines so the start point can be determined. + SuggestedPredefines += "#include \""; + SuggestedPredefines += File; + SuggestedPredefines += "\"\n"; + continue; + } + if (File == ExistingPPOpts.ImplicitPCHInclude) continue; |