diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-27 17:24:53 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-27 17:24:53 +0000 |
commit | f5a1854655ef102b920d800b6c2f12d01bb6f872 (patch) | |
tree | ff5cd5642e6e046c1a380422da595547fb8025a1 /clang/lib/Frontend/ASTUnit.cpp | |
parent | 9d798a07e441c9d586eca7dc600045a3812fc4a6 (diff) | |
download | bcm5719-llvm-f5a1854655ef102b920d800b6c2f12d01bb6f872.tar.gz bcm5719-llvm-f5a1854655ef102b920d800b6c2f12d01bb6f872.zip |
Introduce libclang-level options for C++ precompiled preambles,
separating out chaining precompiled preambles from non-chaining ones.
llvm-svn: 117457
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index e8e80647b40..33abb073316 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -1328,8 +1328,7 @@ bool ASTUnit::LoadFromCompilerInvocation(bool PrecompilePreamble) { llvm::MemoryBuffer *OverrideMainBuffer = 0; - // FIXME: When C++ PCH is ready, allow use of it for a precompiled preamble. - if (PrecompilePreamble && !Invocation->getLangOpts().CPlusPlus) { + if (PrecompilePreamble) { PreambleRebuildCounter = 1; OverrideMainBuffer = getMainBufferWithPrecompiledPreamble(*Invocation); @@ -1386,7 +1385,9 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, bool CaptureDiagnostics, bool PrecompilePreamble, bool CompleteTranslationUnit, - bool CacheCodeCompletionResults) { + bool CacheCodeCompletionResults, + bool CXXPrecompilePreamble, + bool CXXChainedPCH) { bool CreatedDiagnosticsObject = false; if (!Diags.getPtr()) { @@ -1457,6 +1458,16 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, // Override the resources path. CI->getHeaderSearchOpts().ResourceDir = ResourceFilesPath; + // Check whether we should precompile the preamble and/or use chained PCH. + // FIXME: This is a temporary hack while we debug C++ chained PCH. + if (CI->getLangOpts().CPlusPlus) { + PrecompilePreamble = PrecompilePreamble && CXXPrecompilePreamble; + + if (PrecompilePreamble && !CXXChainedPCH && + !CI->getPreprocessorOpts().ImplicitPCHInclude.empty()) + PrecompilePreamble = false; + } + // Create the AST unit. llvm::OwningPtr<ASTUnit> AST; AST.reset(new ASTUnit(false)); |