]> granicus.if.org Git - clang/commitdiff
Driver: Explicitly ignore -fpch-preprocess when using clang, we don't
authorDaniel Dunbar <daniel@zuster.org>
Fri, 3 Apr 2009 20:51:31 +0000 (20:51 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 3 Apr 2009 20:51:31 +0000 (20:51 +0000)
need to do anything special to support this.

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

include/clang/Driver/ArgList.h
include/clang/Driver/Options.def
lib/Driver/ArgList.cpp
lib/Driver/Tools.cpp

index 3fae792d3aef822308bf13f8f3047942aa599720..a0b925279cf39fe8030ea28a224458fd6d3dc275 100644 (file)
@@ -116,6 +116,10 @@ namespace driver {
     void AddAllArgsTranslated(ArgStringList &Output, options::ID Id0,
                               const char *Translation) const;
 
+    /// ClaimAllArgs - Claim all arguments which match the given
+    /// option id.
+    void ClaimAllArgs(options::ID Id0) const;
+
     /// @}
     /// @name Arg Synthesis
     /// @{
index f8b5d42442c43166d11f3df6d05167f16d55611a..febf2e0ffc2c9eb49fc782394b3bbeb05c57f905 100644 (file)
@@ -454,6 +454,7 @@ OPTION("-force_cpusubtype_ALL", force__cpusubtype__ALL, Flag, INVALID, INVALID,
 OPTION("-force_flat_namespace", force__flat__namespace, Flag, INVALID, INVALID, "", 0, 0, 0)
 OPTION("-foutput-class-dir=", foutput_class_dir_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fpascal-strings", fpascal_strings, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fpch-preprocess", fpch_preprocess, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fpic", fpic, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fpie", fpie, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fprint-source-range-info", fprint_source_range_info, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
index 6d19f1acc59f7a5e4159c010c109ecd909ee647e..69cb85b7fc34e81bafc9df671b8318ad3895fa67 100644 (file)
@@ -140,6 +140,15 @@ void ArgList::AddAllArgsTranslated(ArgStringList &Output, options::ID Id0,
   }
 }
 
+void ArgList::ClaimAllArgs(options::ID Id0) const {
+  // FIXME: Make fast.
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
+    const Arg *A = *it;
+    if (A->getOption().matches(Id0))
+      A->claim();
+  }
+}
+
 //
 
 InputArgList::InputArgList(const char **ArgBegin, const char **ArgEnd) 
index 16677439e9da53109c679573f3f1b2d808ea2c12..70daaf5a62f1ff067c0019e9e2673bfd36cf00cc 100644 (file)
@@ -415,6 +415,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     Args.MakeArgString(getToolChain().GetProgramPath(C, "clang-cc").c_str());
   Dest.addCommand(new Command(Exec, CmdArgs));
 
+  // Claim some arguments which clang supports automatically.
+
+  // -fpch-preprocess is used with gcc to add a special marker in the
+  // -output to include the PCH file. Clang's PTH solution is
+  // -completely transparent, so we do not need to deal with it at
+  // -all.
+  Args.ClaimAllArgs(options::OPT_fpch_preprocess);
+  
   // Claim some arguments which clang doesn't support, but we don't
   // care to warn the user about.