[llvm-branch-commits] [cfe-branch] r102562 - in /cfe/branches/Apple/williamson: include/clang/Driver/Options.td lib/Driver/Tools.cpp test/Driver/darwin-objc-options.m
Daniel Dunbar
daniel at zuster.org
Wed Apr 28 16:45:13 PDT 2010
Author: ddunbar
Date: Wed Apr 28 18:45:13 2010
New Revision: 102562
URL: http://llvm.org/viewvc/llvm-project?rev=102562&view=rev
Log:
Driver: Add support for -fobjc-abi-version=. - <rdar://problem/7919678>
Added:
cfe/branches/Apple/williamson/test/Driver/darwin-objc-options.m
Modified:
cfe/branches/Apple/williamson/include/clang/Driver/Options.td
cfe/branches/Apple/williamson/lib/Driver/Tools.cpp
Modified: cfe/branches/Apple/williamson/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/include/clang/Driver/Options.td?rev=102562&r1=102561&r2=102562&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/include/clang/Driver/Options.td (original)
+++ cfe/branches/Apple/williamson/include/clang/Driver/Options.td Wed Apr 28 18:45:13 2010
@@ -321,6 +321,7 @@
def fno_unwind_tables : Flag<"-fno-unwind-tables">, Group<f_Group>;
def fno_working_directory : Flag<"-fno-working-directory">, Group<f_Group>;
def fno_zero_initialized_in_bss : Flag<"-fno-zero-initialized-in-bss">, Group<f_Group>;
+def fobjc_abi_version_EQ : Joined<"-fobjc-abi-version=">, Group<f_Group>;
def fobjc_atdefs : Flag<"-fobjc-atdefs">, Group<clang_ignored_f_Group>;
def fobjc_call_cxx_cdtors : Flag<"-fobjc-call-cxx-cdtors">, Group<clang_ignored_f_Group>;
def fobjc_gc_only : Flag<"-fobjc-gc-only">, Group<f_Group>;
Modified: cfe/branches/Apple/williamson/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Driver/Tools.cpp?rev=102562&r1=102561&r2=102562&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Driver/Tools.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Driver/Tools.cpp Wed Apr 28 18:45:13 2010
@@ -1214,8 +1214,20 @@
// -fobjc-nonfragile-abi=0 is default.
if (types::isObjC(InputType)) {
+ unsigned Version = 1;
if (Args.hasArg(options::OPT_fobjc_nonfragile_abi) ||
- getToolChain().IsObjCNonFragileABIDefault()) {
+ getToolChain().IsObjCNonFragileABIDefault())
+ Version = 2;
+ if (Arg *A = Args.getLastArg(options::OPT_fobjc_abi_version_EQ)) {
+ if (llvm::StringRef(A->getValue(Args)) == "1")
+ Version = 1;
+ else if (llvm::StringRef(A->getValue(Args)) == "2")
+ Version = 2;
+ else
+ D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
+ }
+
+ if (Version == 2) {
CmdArgs.push_back("-fobjc-nonfragile-abi");
// -fobjc-dispatch-method is only relevant with the nonfragile-abi, and
Added: cfe/branches/Apple/williamson/test/Driver/darwin-objc-options.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/test/Driver/darwin-objc-options.m?rev=102562&view=auto
==============================================================================
--- cfe/branches/Apple/williamson/test/Driver/darwin-objc-options.m (added)
+++ cfe/branches/Apple/williamson/test/Driver/darwin-objc-options.m Wed Apr 28 18:45:13 2010
@@ -0,0 +1,19 @@
+// Check miscellaneous Objective-C options.
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -fobjc-abi-version=1 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_ABI1 < %t %s
+
+// CHECK-CHECK-X86_64_ABI1: "-cc1"
+// CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-nonfragile-abi
+// CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-X86_64_ABI1: darwin-objc-options
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -fobjc-abi-version=2 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_ABI2 < %t %s
+
+// CHECK-CHECK-I386_ABI2: "-cc1"
+// CHECK-CHECK-I386_ABI2: -fobjc-nonfragile-abi
+// CHECK-CHECK-I386_ABI2-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_ABI2: darwin-objc-options
More information about the llvm-branch-commits
mailing list