Driver: Enable -integrated-as by default, at least for Darwin/x86 without -static.
 - How else will we figure out what is broken, eh?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103759 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 0c1a5a3..916cdba 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -902,9 +902,16 @@
   // See if we should look for a compiler with an integrated assembler. We match
   // bottom up, so what we are actually looking for is an assembler job with a
   // compiler input.
-  if (C.getArgs().hasArg(options::OPT_integrated_as,
+
+  // FIXME: This doesn't belong here, but ideally we will support static soon
+  // anyway.
+  bool HasStatic = (C.getArgs().hasArg(options::OPT_mkernel) ||
+                    C.getArgs().hasArg(options::OPT_static) ||
+                    C.getArgs().hasArg(options::OPT_fapple_kext));
+  bool IsIADefault = (TC->IsIntegratedAssemblerDefault() && !HasStatic);
+  if (C.getArgs().hasFlag(options::OPT_integrated_as,
                          options::OPT_no_integrated_as,
-                         TC->IsIntegratedAssemblerDefault()) &&
+                         IsIADefault) &&
       !C.getArgs().hasArg(options::OPT_save_temps) &&
       isa<AssembleJobAction>(JA) &&
       Inputs->size() == 1 && isa<CompileJobAction>(*Inputs->begin())) {
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index c15656f..ad975bf 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -56,7 +56,7 @@
 
   /// Whether we are targetting iPhoneOS target.
   mutable bool TargetIsIPhoneOS;
-  
+
   /// The OS version we are targetting.
   mutable unsigned TargetVersion[3];
 
@@ -159,6 +159,11 @@
     else
       return !isMacosxVersionLT(10, 6);
   }
+  virtual bool IsIntegratedAssemblerDefault() const {
+    // Default integrated assembler to on for x86.
+    return (getTriple().getArch() == llvm::Triple::x86 ||
+            getTriple().getArch() == llvm::Triple::x86_64);
+  }
   virtual bool IsObjCNonFragileABIDefault() const {
     // Non-fragile ABI is default for everything but i386.
     return getTriple().getArch() != llvm::Triple::x86;