]> granicus.if.org Git - clang/commitdiff
Add a frontend option -chained-pch and don't pass an active PCH reader to the PCH...
authorSebastian Redl <sebastian.redl@getdesigned.at>
Fri, 9 Jul 2010 00:00:58 +0000 (00:00 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Fri, 9 Jul 2010 00:00:58 +0000 (00:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107936 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CC1Options.td
include/clang/Frontend/FrontendOptions.h
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/FrontendActions.cpp

index 8e813fbfd27670920873b687b1b4417b7ad59716..51695a0848a6272221bd9b26d1c262000f0d09bb 100644 (file)
@@ -347,6 +347,8 @@ def rewrite_macros : Flag<"-rewrite-macros">,
 
 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">,
index 0f4538976d5746910cba9bf7a2d0d747681de5fa..4010ea6dd7dcf884d2147eed58e5d52905a7955f 100644 (file)
@@ -62,6 +62,9 @@ public:
   unsigned RelocatablePCH : 1;             ///< When generating PCH files,
                                            /// instruct the PCH writer to create
                                            /// relocatable PCH files.
+  unsigned ChainedPCH : 1;                 ///< When generating PCH files,
+                                           /// instruct the PCH writer to create
+                                           /// chained PCH files.
   unsigned ShowHelp : 1;                   ///< Show the -help text.
   unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion
                                            /// results.
@@ -114,6 +117,7 @@ public:
     ProgramAction = frontend::ParseSyntaxOnly;
     ActionName = "";
     RelocatablePCH = 0;
+    ChainedPCH = 0;
     ShowHelp = 0;
     ShowMacrosInCodeCompletion = 0;
     ShowCodePatternsInCodeCompletion = 0;
index 252034125599c9c687458b438c1493c80b4c1ddd..239283a0cc53f11c0f23eaa68144ac0c37bc7122 100644 (file)
@@ -353,6 +353,8 @@ 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)
@@ -1032,6 +1034,7 @@ 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
index 400d35361c9a116b73890ea96227d6ff39bb97d8..694cadcd13c063d01483d075e8f4926b5613bd90 100644 (file)
@@ -82,7 +82,9 @@ ASTConsumer *GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI,
 
   if (CI.getFrontendOpts().RelocatablePCH)
     return CreatePCHGenerator(CI.getPreprocessor(), OS,
-                              CI.getPCHReader(), Sysroot.c_str());
+                              CI.getInvocation().getFrontendOpts().ChainedPCH ?
+                                 CI.getPCHReader() : 0,
+                              Sysroot.c_str());
 
   return CreatePCHGenerator(CI.getPreprocessor(), OS, CI.getPCHReader());
 }