Remove code to fall back to llvm-gcc for i386 kexts.
authorBob Wilson <bob.wilson@apple.com>
Thu, 8 Nov 2012 01:03:29 +0000 (01:03 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 8 Nov 2012 01:03:29 +0000 (01:03 +0000)
More cleanups to follow in separate commits....

llvm-svn: 167566

clang/include/clang/Driver/Driver.h
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains.cpp
clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
clang/test/Driver/apple-kext-i386.cpp [deleted file]

index fa83c37..b752ce6 100644 (file)
@@ -146,9 +146,6 @@ private:
   /// jobs.
   unsigned CheckInputsExist : 1;
 
-  /// \brief Force use of clang frontend.
-  unsigned ForcedClangUse : 1;
-
 public:
   /// Use lazy precompiled headers for PCH support.
   unsigned CCCUsePCH : 1;
@@ -218,9 +215,6 @@ public:
     InstalledDir = Value;
   }
 
-  bool shouldForceClangUse() const { return ForcedClangUse; }
-  void setForcedClangUse(bool V = true) { ForcedClangUse = V; }
-
   /// @}
   /// @name Primary Functionality
   /// @{
index 4fc6db9..9881bba 100644 (file)
@@ -58,7 +58,7 @@ Driver::Driver(StringRef ClangExecutable,
     CCCIsCPP(false),CCCEcho(false), CCCPrintBindings(false),
     CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false),
     CCGenDiagnostics(false), CCCGenericGCCName(""), CheckInputsExist(true),
-    ForcedClangUse(false), CCCUsePCH(true), SuppressMissingInputWarning(false) {
+    CCCUsePCH(true), SuppressMissingInputWarning(false) {
 
   Name = llvm::sys::path::stem(ClangExecutable);
   Dir  = llvm::sys::path::parent_path(ClangExecutable);
index 149b8a1..e5fbc52 100644 (file)
@@ -183,24 +183,11 @@ void Generic_ELF::anchor() {}
 Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA,
                          const ActionList &Inputs) const {
   Action::ActionClass Key = JA.getKind();
-  bool useClang = false;
 
   if (getDriver().ShouldUseClangCompiler(C, JA, getTriple())) {
-    useClang = true;
-    // Fallback to llvm-gcc for i386 kext compiles, we don't support that ABI.
-    if (!getDriver().shouldForceClangUse() &&
-        Inputs.size() == 1 &&
-        types::isCXX(Inputs[0]->getType()) &&
-        getTriple().isOSDarwin() &&
-        getTriple().getArch() == llvm::Triple::x86 &&
-        (C.getArgs().getLastArg(options::OPT_fapple_kext) ||
-         C.getArgs().getLastArg(options::OPT_mkernel)))
-      useClang = false;
-  }
-
-  // FIXME: This seems like a hacky way to choose clang frontend.
-  if (useClang)
+    // FIXME: This seems like a hacky way to choose clang frontend.
     Key = Action::AnalyzeJobClass;
+  }
 
   bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
                                              options::OPT_no_integrated_as,
index 0611291..d82cb6d 100644 (file)
@@ -49,11 +49,6 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,
   // FIXME: We shouldn't have to pass in the path info.
   driver::Driver TheDriver("clang", llvm::sys::getDefaultTargetTriple(),
                            "a.out", false, *Diags);
-  // Force driver to use clang.
-  // FIXME: This seems like a hack. Maybe the "Clang" tool subclass should be
-  // available for using it to get the arguments, thus avoiding the overkill
-  // of using the driver.
-  TheDriver.setForcedClangUse();
 
   // Don't check that inputs exist, they may have been remapped.
   TheDriver.setCheckInputsExist(false);
diff --git a/clang/test/Driver/apple-kext-i386.cpp b/clang/test/Driver/apple-kext-i386.cpp
deleted file mode 100644 (file)
index db7a080..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-// Check that we transparently fallback to llvm-gcc for i386 kexts, we don't
-// support the ABI they use (yet).
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN:   -fapple-kext -### -fsyntax-only %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK < %t %s
-
-// CHECK: cc1plus"
-// CHECK: "-fapple-kext"
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN:   -mkernel -### -fsyntax-only %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-MKERNEL < %t %s
-
-// CHECK-MKERNEL: cc1plus"
-// CHECK-MKERNEL: "-mkernel"
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN:   -Wno-self-assign -Wc++11-extensions -Wno-microsoft -Wmicrosoft -Wvla \
-// RUN:   -faltivec -mthumb -mcpu=G4 -mlongcall -mno-longcall -msoft-float \
-// RUN:   -Wno-int-conversion -Wconstant-conversion -Wenum-conversion \
-// 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"
-// CHECK-UNSUPPORTED-NOT: "-Wc++11-extensions"
-// CHECK-UNSUPPORTED-NOT: "-Wno-microsoft"
-// CHECK-UNSUPPORTED-NOT: "-Wmicrosoft"
-// CHECK-UNSUPPORTED-NOT: "-Wvla"
-// CHECK-UNSUPPORTED-NOT: "-faltivec"
-// CHECK-UNSUPPORTED-NOT: "-mthumb"
-// CHECK-UNSUPPORTED-NOT: "-mlongcall"
-// CHECK-UNSUPPORTED: "-mno-longcall"
-// CHECK-UNSUPPORTED: "-msoft-float"
-// CHECK-UNSUPPORTED-NOT: "-Wno-int-conversion"
-// CHECK-UNSUPPORTED-NOT: "-Wconstant-conversion"
-// CHECK-UNSUPPORTED-NOT: "-Wenum-conversion"
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN:   -Wconstant-logical-operand -save-temps \
-// RUN:   -fapple-kext -### -fsyntax-only %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED2 < %t %s
-
-// CHECK-UNSUPPORTED2: cc1plus"
-// CHECK-UNSUPPORTED2-NOT: "-Wconstant-logical-operand"
-
-// Check that -serialize-diagnostics does not cause an "argument unused" error.
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN:   -Wall -fapple-kext -### -serialize-diagnostics %t.dia -c %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=CHECK-UNUSED %s
-
-// Check that --serialize-diagnostics does not cause an "argument unused" error.
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN:   -Wall -fapple-kext -### --serialize-diagnostics %t.dia -c %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=CHECK-UNUSED %s
-
-// CHECK-UNUSED-NOT: argument unused
-// CHECK-UNUSED: cc1plus