Skip to content

Commit ae933a5

Browse files
committed
Driver: Remove support for -fobjc-gc*
As a first step toward removing Objective-C garbage collection from Clang, remove support from the driver. I'm hoping this will flush out any expected bots/configurations/whatever that might rely on it. I've left the options behind temporarily in -cc1 to keep tests passing. I'll kill them off entirely in a follow up when I've had a chance to update/delete the rest of Clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288872 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0c9cb64 commit ae933a5

File tree

7 files changed

+7
-58
lines changed

7 files changed

+7
-58
lines changed

docs/CommandGuide/clang.rst

-10
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,6 @@ Language Selection and Mode Options
167167

168168
Enable the "Blocks" language feature.
169169

170-
.. option:: -fobjc-gc-only
171-
172-
Indicate that Objective-C code should be compiled in GC-only mode, which only
173-
works when Objective-C Garbage Collection is enabled.
174-
175-
.. option:: -fobjc-gc
176-
177-
Indicate that Objective-C code should be compiled in hybrid-GC mode, which
178-
works with both GC and non-GC mode.
179-
180170
.. option:: -fobjc-abi-version=version
181171

182172
Select the Objective-C ABI version to use. Available versions are 1 (legacy

include/clang/Basic/DiagnosticDriverKinds.td

-4
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ def err_drv_preamble_format : Error<
137137
"incorrect format for -preamble-bytes=N,END">;
138138
def err_drv_conflicting_deployment_targets : Error<
139139
"conflicting deployment targets, both '%0' and '%1' are present in environment">;
140-
def err_drv_objc_gc_arr : Error<
141-
"cannot specify both '-fobjc-arc' and '%0'">;
142140
def err_arc_unsupported_on_runtime : Error<
143141
"-fobjc-arc is not supported on platforms using the legacy runtime">;
144142
def err_arc_unsupported_on_toolchain : Error< // feel free to generalize this
@@ -211,8 +209,6 @@ def warn_drv_overriding_flag_option : Warning<
211209
def warn_drv_treating_input_as_cxx : Warning<
212210
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
213211
InGroup<Deprecated>;
214-
def warn_drv_objc_gc_unsupported : Warning<
215-
"Objective-C garbage collection is not supported on this platform, ignoring '%0'">;
216212
def warn_drv_pch_not_first_include : Warning<
217213
"precompiled header '%0' was ignored because '%1' is not first '-include'">;
218214
def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,

include/clang/Driver/CC1Options.td

+6
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,12 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
641641
def finclude_default_header : Flag<["-"], "finclude-default-header">,
642642
HelpText<"Include the default header file for OpenCL">;
643643

644+
// FIXME: Remove these entirely once functionality/tests have been excised.
645+
def fobjc_gc_only : Flag<["-"], "fobjc-gc-only">, Group<f_Group>,
646+
HelpText<"Use GC exclusively for Objective-C related memory management">;
647+
def fobjc_gc : Flag<["-"], "fobjc-gc">, Group<f_Group>,
648+
HelpText<"Enable Objective-C garbage collection">;
649+
644650
//===----------------------------------------------------------------------===//
645651
// Header Search Options
646652
//===----------------------------------------------------------------------===//

include/clang/Driver/Options.td

-4
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,6 @@ def : Flag<["-"], "faligned-new">, Alias<faligned_allocation>;
10921092
def : Flag<["-"], "fno-aligned-new">, Alias<fno_aligned_allocation>;
10931093
def faligned_new_EQ : Joined<["-"], "faligned-new=">;
10941094

1095-
def fobjc_gc_only : Flag<["-"], "fobjc-gc-only">, Group<f_Group>, Flags<[CC1Option]>,
1096-
HelpText<"Use GC exclusively for Objective-C related memory management">;
1097-
def fobjc_gc : Flag<["-"], "fobjc-gc">, Group<f_Group>, Flags<[CC1Option]>,
1098-
HelpText<"Enable Objective-C garbage collection">;
10991095
def fobjc_legacy_dispatch : Flag<["-"], "fobjc-legacy-dispatch">, Group<f_Group>;
11001096
def fobjc_new_property : Flag<["-"], "fobjc-new-property">, Group<clang_ignored_f_Group>;
11011097
def fobjc_infer_related_result_type : Flag<["-"], "fobjc-infer-related-result-type">,

lib/Driver/Tools.cpp

-19
Original file line numberDiff line numberDiff line change
@@ -6005,31 +6005,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
60056005
if (rewriteKind != RK_None)
60066006
CmdArgs.push_back("-fno-objc-infer-related-result-type");
60076007

6008-
// Handle -fobjc-gc and -fobjc-gc-only. They are exclusive, and -fobjc-gc-only
6009-
// takes precedence.
6010-
const Arg *GCArg = Args.getLastArg(options::OPT_fobjc_gc_only);
6011-
if (!GCArg)
6012-
GCArg = Args.getLastArg(options::OPT_fobjc_gc);
6013-
if (GCArg) {
6014-
if (ARC) {
6015-
D.Diag(diag::err_drv_objc_gc_arr) << GCArg->getAsString(Args);
6016-
} else if (getToolChain().SupportsObjCGC()) {
6017-
GCArg->render(Args, CmdArgs);
6018-
} else {
6019-
// FIXME: We should move this to a hard error.
6020-
D.Diag(diag::warn_drv_objc_gc_unsupported) << GCArg->getAsString(Args);
6021-
}
6022-
}
6023-
60246008
// Pass down -fobjc-weak or -fno-objc-weak if present.
60256009
if (types::isObjC(InputType)) {
60266010
auto WeakArg = Args.getLastArg(options::OPT_fobjc_weak,
60276011
options::OPT_fno_objc_weak);
60286012
if (!WeakArg) {
60296013
// nothing to do
6030-
} else if (GCArg) {
6031-
if (WeakArg->getOption().matches(options::OPT_fobjc_weak))
6032-
D.Diag(diag::err_objc_weak_with_gc);
60336014
} else if (!objcRuntime.allowsWeak()) {
60346015
if (WeakArg->getOption().matches(options::OPT_fobjc_weak))
60356016
D.Diag(diag::err_objc_weak_unsupported);

test/Driver/darwin-objc-gc.m

-19
This file was deleted.

test/Misc/warning-flags.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This test serves two purposes:
1818

1919
The list of warnings below should NEVER grow. It should gradually shrink to 0.
2020

21-
CHECK: Warnings without flags (80):
21+
CHECK: Warnings without flags (79):
2222
CHECK-NEXT: ext_excess_initializers
2323
CHECK-NEXT: ext_excess_initializers_in_char_array_initializer
2424
CHECK-NEXT: ext_expected_semi_decl_list
@@ -54,7 +54,6 @@ CHECK-NEXT: warn_delete_array_type
5454
CHECK-NEXT: warn_double_const_requires_fp64
5555
CHECK-NEXT: warn_drv_assuming_mfloat_abi_is
5656
CHECK-NEXT: warn_drv_clang_unsupported
57-
CHECK-NEXT: warn_drv_objc_gc_unsupported
5857
CHECK-NEXT: warn_drv_pch_not_first_include
5958
CHECK-NEXT: warn_dup_category_def
6059
CHECK-NEXT: warn_enum_value_overflow

0 commit comments

Comments
 (0)