forked from OSchip/llvm-project
Driver: Add support for -fobjc-abi-version=.
- <rdar://problem/7919678> llvm-svn: 102559
This commit is contained in:
parent
bb728e17d3
commit
12c82080a2
|
@ -329,6 +329,7 @@ def fno_unit_at_a_time : Flag<"-fno-unit-at-a-time">, Group<f_Group>;
|
|||
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>;
|
||||
|
|
|
@ -1227,8 +1227,20 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
// -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue