NeXT: Clean up dispatch method policy selection.
 - Replace -cc1 level -fobjc-legacy-dispatch with -fobjc-dispatch-method={legacy,non-legacy,mixed}.

 - Lift "mixed" vs "non-mixed" policy choice up to driver level, instead of being buried in CGObjCMac.cpp.

 - No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102255 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 2e8db00..8ad04aa 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1230,13 +1230,17 @@
     if (Args.hasArg(options::OPT_fobjc_nonfragile_abi) ||
         getToolChain().IsObjCNonFragileABIDefault()) {
       CmdArgs.push_back("-fobjc-nonfragile-abi");
-      
-      // -fobjc-legacy-dispatch is only relevant with the nonfragile-abi, and
-      // defaults to off.
-      if (Args.hasFlag(options::OPT_fobjc_legacy_dispatch,
-                       options::OPT_fno_objc_legacy_dispatch,
-                       getToolChain().IsObjCLegacyDispatchDefault()))
-        CmdArgs.push_back("-fobjc-legacy-dispatch");
+
+      // -fobjc-dispatch-method is only relevant with the nonfragile-abi, and
+      // legacy is the default.
+      if (!Args.hasFlag(options::OPT_fobjc_legacy_dispatch,
+                        options::OPT_fno_objc_legacy_dispatch,
+                        getToolChain().IsObjCLegacyDispatchDefault())) {
+        if (getToolChain().UseObjCMixedDispatch())
+          CmdArgs.push_back("-fobjc-dispatch-method=mixed");
+        else
+          CmdArgs.push_back("-fobjc-dispatch-method=non-legacy");
+      }
     }
   }