[cfe-commits] r137842 - in /cfe/trunk: lib/Driver/Tools.cpp lib/Driver/Tools.h test/Driver/apple-kext-i386.cpp

Chad Rosier mcrosier at apple.com
Wed Aug 17 11:24:55 PDT 2011


Author: mcrosier
Date: Wed Aug 17 13:24:55 2011
New Revision: 137842

URL: http://llvm.org/viewvc/llvm-project?rev=137842&view=rev
Log:
[driver] Clang doesn't support -mkernel/-fapple-kext for i386, so it's 
automatically invoking llvm-gcc's cc1plus, which doesn't support all options
supported by Clang.  Therefore, filter out unsupported options.
rdar://9964354

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/lib/Driver/Tools.h
    cfe/trunk/test/Driver/apple-kext-i386.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=137842&r1=137841&r2=137842&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 17 13:24:55 2011
@@ -2446,6 +2446,18 @@
   return Args.MakeArgString(Res + ".d");
 }
 
+void darwin::CC1::RemoveCC1UnsupportedArgs(ArgStringList &CmdArgs) const {
+  for (ArgStringList::iterator it = CmdArgs.begin(), ie = CmdArgs.end(); 
+       it != ie;) {
+    if (!strcmp(*it, "-Wno-self-assign")) {
+      it = CmdArgs.erase(it);
+      it = CmdArgs.end();
+    }
+    else
+      ++it;
+  }
+}
+
 void darwin::CC1::AddCC1Args(const ArgList &Args,
                              ArgStringList &CmdArgs) const {
   const Driver &D = getToolChain().getDriver();
@@ -2853,6 +2865,8 @@
     CmdArgs.push_back(Output.getFilename());
   }
 
+  RemoveCC1UnsupportedArgs(CmdArgs);
+
   const char *CC1Name = getCC1Name(Inputs[0].getType());
   const char *Exec =
     Args.MakeArgString(getToolChain().GetProgramPath(CC1Name));

Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=137842&r1=137841&r2=137842&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Wed Aug 17 13:24:55 2011
@@ -178,6 +178,7 @@
     const char *getCC1Name(types::ID Type) const;
 
     void AddCC1Args(const ArgList &Args, ArgStringList &CmdArgs) const;
+    void RemoveCC1UnsupportedArgs(ArgStringList &CmdArgs) const;
     void AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
                            const InputInfoList &Inputs,
                            const ArgStringList &OutputArgs) const;

Modified: cfe/trunk/test/Driver/apple-kext-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/apple-kext-i386.cpp?rev=137842&r1=137841&r2=137842&view=diff
==============================================================================
--- cfe/trunk/test/Driver/apple-kext-i386.cpp (original)
+++ cfe/trunk/test/Driver/apple-kext-i386.cpp Wed Aug 17 13:24:55 2011
@@ -14,3 +14,11 @@
 
 // CHECK-MKERNEL: cc1plus"
 // CHECK-MKERNEL: "-mkernel"
+
+// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
+// RUN:   -Wno-self-assign \
+// RUN:   -fapple-kext -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED < %t %s
+
+// CHECK-UNSUPPORTED: cc1plus"
+// CHECK-UNSUPPORTED-NOT: "-Wno-self-assign"





More information about the cfe-commits mailing list