]> granicus.if.org Git - clang/commitdiff
Set PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.
authorIlya Biryukov <ibiryukov@google.com>
Mon, 9 Oct 2017 16:52:12 +0000 (16:52 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Mon, 9 Oct 2017 16:52:12 +0000 (16:52 +0000)
Summary:
It was previsouly set only in ASTUnit, but it should be set for all client of
PrecompiledPreamble.

Reviewers: erikjv, bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D38617

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315212 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ASTUnit.cpp
lib/Frontend/PrecompiledPreamble.cpp

index b644ef81222bf38bd08e0de3568a98e69242bda2..9eeec37a758f7a85daea02a69ef72baf4e6b9180 100644 (file)
@@ -1698,7 +1698,6 @@ ASTUnit *ASTUnit::LoadFromCommandLine(
   PreprocessorOptions &PPOpts = CI->getPreprocessorOpts();
   PPOpts.RemappedFilesKeepOriginalName = RemappedFilesKeepOriginalName;
   PPOpts.AllowPCHWithCompilerErrors = AllowPCHWithCompilerErrors;
-  PPOpts.GeneratePreamble = PrecompilePreambleAfterNParses != 0;
   PPOpts.SingleFileParseMode = SingleFileParse;
   
   // Override the resources path.
index bd6770acdff5bbe85138b8ee74d51c4a14163759..81466d0c286553a076982ac177af046ecf971522 100644 (file)
@@ -234,6 +234,8 @@ llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
   FrontendOpts.OutputFile = PreamblePCHFile->getFilePath();
   PreprocessorOpts.PrecompiledPreambleBytes.first = 0;
   PreprocessorOpts.PrecompiledPreambleBytes.second = false;
+  // Inform preprocessor to record conditional stack when building the preamble.
+  PreprocessorOpts.GeneratePreamble = true;
 
   // Create the compiler instance to use for building the precompiled preamble.
   std::unique_ptr<CompilerInstance> Clang(