From: Fariborz Jahanian Date: Mon, 20 Jan 2014 19:32:33 +0000 (+0000) Subject: ObjectiveC driver. reinstate -fno-objc-legacy-dispatch behavior X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=015f92d36592bf95f6a71a24b64031479a990d35;p=clang ObjectiveC driver. reinstate -fno-objc-legacy-dispatch behavior when the deployment target is 10.5. // rdar://15852259 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199682 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/ObjCRuntime.h b/include/clang/Basic/ObjCRuntime.h index 4c64497503..37c9ec2bf6 100644 --- a/include/clang/Basic/ObjCRuntime.h +++ b/include/clang/Basic/ObjCRuntime.h @@ -99,6 +99,15 @@ public: Arch == llvm::Triple::x86_64) return false; } + else if (isNeXTFamily() && getVersion().getMajor() == 10) { + unsigned minor = 0; + if (getVersion().getMinor().hasValue()) + minor = getVersion().getMinor().getValue(); + if (minor == 5 && + (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64)) + return false; + } + // Except for deployment target of 10.5, // Mac runtimes use legacy dispatch everywhere now. return true; } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 92f35f3538..699d7cfdc2 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3324,9 +3324,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, ObjCRuntime objcRuntime = AddObjCRuntimeArgs(Args, CmdArgs, rewriteKind); // -fobjc-dispatch-method is only relevant with the nonfragile-abi, and - // legacy is the default. Next runtime is always legacy dispatch and - // -fno-objc-legacy-dispatch gets ignored silently. - if (objcRuntime.isNonFragile() && !objcRuntime.isNeXTFamily()) { + // legacy is the default. Except for deployment taget of 10.5, + // next runtime is always legacy dispatch and -fno-objc-legacy-dispatch + // gets ignored silently. + if (objcRuntime.isNonFragile()) { if (!Args.hasFlag(options::OPT_fobjc_legacy_dispatch, options::OPT_fno_objc_legacy_dispatch, objcRuntime.isLegacyDispatchDefaultForArch( diff --git a/test/Driver/darwin-objc-defaults.m b/test/Driver/darwin-objc-defaults.m index 1742deb1b1..6f5ed87d28 100644 --- a/test/Driver/darwin-objc-defaults.m +++ b/test/Driver/darwin-objc-defaults.m @@ -37,6 +37,7 @@ // CHECK-CHECK-X86_64_OSX10_5: "-cc1" // CHECK-CHECK-X86_64_OSX10_5: -fobjc-runtime=macosx-10.5 +// CHECK-CHECK-X86_64_OSX10_5: -fobjc-dispatch-method=non-legacy // CHECK-CHECK-X86_64_OSX10_5: darwin-objc-defaults // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \