From: Douglas Gregor Date: Thu, 25 Aug 2011 22:54:01 +0000 (+0000) Subject: Eliminate the -chained-pch flag and all of the frontend and libclang options associat... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5af843a20e237ad1a13ad66a867e200695b8c8e;p=clang Eliminate the -chained-pch flag and all of the frontend and libclang options associated with it. Chained PCH is the only way to build a PCH file that includes another PCH file git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138597 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index e16a21ef35..7c32250438 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -824,18 +824,18 @@ enum CXTranslationUnit_Flags { */ CXTranslationUnit_CacheCompletionResults = 0x08, /** - * \brief Enable precompiled preambles in C++. + * \brief DEPRECATED: Enable precompiled preambles in C++. * * Note: this is a *temporary* option that is available only while - * we are testing C++ precompiled preamble support. + * we are testing C++ precompiled preamble support. It is deprecated. */ CXTranslationUnit_CXXPrecompiledPreamble = 0x10, /** - * \brief Enabled chained precompiled preambles in C++. + * \brief DEPRECATED: Enabled chained precompiled preambles in C++. * * Note: this is a *temporary* option that is available only while - * we are testing C++ precompiled preamble support. + * we are testing C++ precompiled preamble support. It is deprecated. */ CXTranslationUnit_CXXChainedPCH = 0x20, diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 2c3bfc07a0..322aef41b7 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -412,8 +412,6 @@ def working_directory_EQ : Joined<"-working-directory=">, def relocatable_pch : Flag<"-relocatable-pch">, HelpText<"Whether to build a relocatable precompiled header">; -def chained_pch : Flag<"-chained-pch">, - HelpText<"Whether to chain the new precompiled header to the old one.">; def print_stats : Flag<"-print-stats">, HelpText<"Print performance metrics and statistics">; def ftime_report : Flag<"-ftime-report">, diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 08b626facc..190ab85713 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -651,8 +651,6 @@ public: bool PrecompilePreamble = false, TranslationUnitKind TUKind = TU_Complete, bool CacheCodeCompletionResults = false, - bool CXXPrecompilePreamble = false, - bool CXXChainedPCH = false, bool NestedMacroExpansions = true); /// \brief Reparse the source files using the same command-line options that diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index 75e3eba80c..ec75b59c4e 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -59,9 +59,6 @@ public: unsigned RelocatablePCH : 1; ///< When generating PCH files, /// instruct the AST writer to create /// relocatable PCH files. - unsigned ChainedPCH : 1; ///< When generating PCH files, - /// instruct the AST writer to create - /// chained PCH files. unsigned ShowHelp : 1; ///< Show the -help text. unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion /// results. @@ -135,7 +132,6 @@ public: ProgramAction = frontend::ParseSyntaxOnly; ActionName = ""; RelocatablePCH = 0; - ChainedPCH = 0; ShowHelp = 0; ShowMacrosInCodeCompletion = 0; ShowCodePatternsInCodeCompletion = 0; diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index e3d56367fd..4a5a29a9c9 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -1354,7 +1354,6 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( // Tell the compiler invocation to generate a temporary precompiled header. FrontendOpts.ProgramAction = frontend::GeneratePCH; - FrontendOpts.ChainedPCH = true; // FIXME: Generate the precompiled header into memory? FrontendOpts.OutputFile = PreamblePCHPath; PreprocessorOpts.PrecompiledPreambleBytes.first = 0; @@ -1761,8 +1760,6 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, bool PrecompilePreamble, TranslationUnitKind TUKind, bool CacheCodeCompletionResults, - bool CXXPrecompilePreamble, - bool CXXChainedPCH, bool NestedMacroExpansions) { if (!Diags.getPtr()) { // No diagnostics engine was provided, so create our own diagnostics object @@ -1805,16 +1802,6 @@ 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 AST; AST.reset(new ASTUnit(false)); diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 763c8a1e8b..aee69083c1 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -405,8 +405,6 @@ static void FrontendOptsToArgs(const FrontendOptions &Opts, Res.push_back("-disable-free"); if (Opts.RelocatablePCH) Res.push_back("-relocatable-pch"); - if (Opts.ChainedPCH) - Res.push_back("-chained-pch"); if (Opts.ShowHelp) Res.push_back("-help"); if (Opts.ShowMacrosInCodeCompletion) @@ -1271,7 +1269,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Opts.OutputFile = Args.getLastArgValue(OPT_o); Opts.Plugins = Args.getAllArgValues(OPT_load); Opts.RelocatablePCH = Args.hasArg(OPT_relocatable_pch); - Opts.ChainedPCH = Args.hasArg(OPT_chained_pch); Opts.ShowHelp = Args.hasArg(OPT_help); Opts.ShowMacrosInCodeCompletion = Args.hasArg(OPT_code_completion_macros); Opts.ShowCodePatternsInCodeCompletion diff --git a/test/PCH/chain-decls.c b/test/PCH/chain-decls.c index b3daa4a7b7..f5724c4c13 100644 --- a/test/PCH/chain-decls.c +++ b/test/PCH/chain-decls.c @@ -3,7 +3,7 @@ // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-decls1.h -// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-decls2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-decls2.h -include-pch %t1 // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s diff --git a/test/PCH/chain-ext_vector.c b/test/PCH/chain-ext_vector.c index 263507003d..d99a732f2f 100644 --- a/test/PCH/chain-ext_vector.c +++ b/test/PCH/chain-ext_vector.c @@ -3,7 +3,7 @@ // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-ext_vector1.h -// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-ext_vector2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-ext_vector2.h -include-pch %t1 // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s int test(float4 f4) { diff --git a/test/PCH/chain-external-defs.c b/test/PCH/chain-external-defs.c index dd92d8e63a..7422294428 100644 --- a/test/PCH/chain-external-defs.c +++ b/test/PCH/chain-external-defs.c @@ -1,6 +1,6 @@ // Test with pch. // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t1.pch %S/Inputs/chain-external-defs1.h -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t2.pch %S/Inputs/chain-external-defs2.h -include-pch %t1.pch -chained-pch +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t2.pch %S/Inputs/chain-external-defs2.h -include-pch %t1.pch // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t2.pch -emit-llvm -o %t %s // RUN: echo FINI >> %t // RUN: FileCheck -input-file=%t -check-prefix=Z %s diff --git a/test/PCH/chain-macro-override.c b/test/PCH/chain-macro-override.c index 8e208815fb..2713e7084a 100644 --- a/test/PCH/chain-macro-override.c +++ b/test/PCH/chain-macro-override.c @@ -3,7 +3,7 @@ // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro-override1.h -detailed-preprocessing-record -// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -chained-pch -detailed-preprocessing-record +// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -detailed-preprocessing-record // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s int foo() { diff --git a/test/PCH/chain-macro.c b/test/PCH/chain-macro.c index 68b18deb08..18356f75a0 100644 --- a/test/PCH/chain-macro.c +++ b/test/PCH/chain-macro.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-pch -o %t1 -detailed-preprocessing-record %S/Inputs/chain-macro1.h -// RUN: %clang_cc1 -emit-pch -o %t2 -detailed-preprocessing-record %S/Inputs/chain-macro2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 -detailed-preprocessing-record %S/Inputs/chain-macro2.h -include-pch %t1 // RUN: %clang_cc1 -fsyntax-only -verify -include-pch %t2 %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s diff --git a/test/PCH/chain-predecl.m b/test/PCH/chain-predecl.m index 2b0444e15a..6723b6f6f2 100644 --- a/test/PCH/chain-predecl.m +++ b/test/PCH/chain-predecl.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-pch -o %t1 %S/chain-predecl.h -x objective-c -// RUN: %clang_cc1 -emit-pch -o %t2 %s -x objective-c -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 %s -x objective-c -include-pch %t1 // Test predeclarations across chained PCH. @interface Foo diff --git a/test/PCH/chain-remap-types.m b/test/PCH/chain-remap-types.m index a45a79d75c..7886332faf 100644 --- a/test/PCH/chain-remap-types.m +++ b/test/PCH/chain-remap-types.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t1 %S/Inputs/chain-remap-types1.h -// RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t2 %S/Inputs/chain-remap-types2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t2 %S/Inputs/chain-remap-types2.h -include-pch %t1 // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s diff --git a/test/PCH/chain-selectors.m b/test/PCH/chain-selectors.m index 3b19172799..c543b7106d 100644 --- a/test/PCH/chain-selectors.m +++ b/test/PCH/chain-selectors.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -Wselector -include %S/Inputs/chain-selectors1.h -include %S/Inputs/chain-selectors2.h // RUN: %clang_cc1 -x objective-c -emit-pch -o %t1 %S/Inputs/chain-selectors1.h -// RUN: %clang_cc1 -x objective-c -emit-pch -o %t2 %S/Inputs/chain-selectors2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -x objective-c -emit-pch -o %t2 %S/Inputs/chain-selectors2.h -include-pch %t1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wselector -include-pch %t2 @implementation X diff --git a/test/PCH/chain-trivial.c b/test/PCH/chain-trivial.c index c78b0e44ef..85b1eabd86 100644 --- a/test/PCH/chain-trivial.c +++ b/test/PCH/chain-trivial.c @@ -1,4 +1,4 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t1 %S/Inputs/chain-trivial1.h -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t2 -include-pch %t1 -chained-pch %S/Inputs/chain-trivial2.h +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t2 -include-pch %t1 %S/Inputs/chain-trivial2.h // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-print -include-pch %t2 %s | FileCheck %s // CHECK: struct __va_list_tag { diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 5837e0412d..c7e492e074 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2414,9 +2414,7 @@ CXTranslationUnit clang_createTranslationUnit(CXIndex CIdx, unsigned clang_defaultEditingTranslationUnitOptions() { return CXTranslationUnit_PrecompiledPreamble | - CXTranslationUnit_CacheCompletionResults | - CXTranslationUnit_CXXPrecompiledPreamble | - CXTranslationUnit_CXXChainedPCH; + CXTranslationUnit_CacheCompletionResults; } CXTranslationUnit @@ -2467,10 +2465,6 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { = (options & CXTranslationUnit_Incomplete)? TU_Prefix : TU_Complete; bool CacheCodeCompetionResults = options & CXTranslationUnit_CacheCompletionResults; - bool CXXPrecompilePreamble - = options & CXTranslationUnit_CXXPrecompiledPreamble; - bool CXXChainedPCH - = options & CXTranslationUnit_CXXChainedPCH; // Configure the diagnostics. DiagnosticOptions DiagOpts; @@ -2556,8 +2550,6 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { PrecompilePreamble, TUKind, CacheCodeCompetionResults, - CXXPrecompilePreamble, - CXXChainedPCH, NestedMacroExpansions)); if (NumErrors != Diags->getClient()->getNumErrors()) {