Change the driver's logic about Objective-C runtimes: abstract out a
structure to hold inferred information, then propagate each invididual
bit down to -cc1. Separate the bits of "supports weak" and "has a native
ARC runtime"; make the latter a CodeGenOption.
The tool chain is still driving this decision, because it's the place that
has the required deployment target information on Darwin, but at least it's
better-factored now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134453 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 12e51a6..31c8643 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -123,6 +123,8 @@
Res.push_back("-dwarf-debug-flags");
Res.push_back(Opts.DwarfDebugFlags);
}
+ if (Opts.ObjCRuntimeHasARC)
+ Res.push_back("-fobjc-runtime-has-arc");
if (Opts.EmitGcovArcs)
Res.push_back("-femit-coverage-data");
if (Opts.EmitGcovNotes)
@@ -690,8 +692,8 @@
}
if (Opts.ObjCAutoRefCount)
Res.push_back("-fobjc-arc");
- if (Opts.ObjCNoAutoRefCountRuntime)
- Res.push_back("-fobjc-no-arc-runtime");
+ if (Opts.ObjCRuntimeHasWeak)
+ Res.push_back("-fobjc-runtime-has-weak");
if (!Opts.ObjCInferRelatedResultType)
Res.push_back("-fno-objc-infer-related-result-type");
@@ -976,6 +978,7 @@
Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);
+ Opts.ObjCRuntimeHasARC = Args.hasArg(OPT_fobjc_runtime_has_arc);
Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
Opts.CodeModel = Args.getLastArgValue(OPT_mcode_model);
@@ -1532,10 +1535,11 @@
Opts.ObjCAutoRefCount = 1;
if (!Args.hasArg(OPT_fobjc_nonfragile_abi))
Diags.Report(diag::err_arc_nonfragile_abi);
- if (Args.hasArg(OPT_fobjc_no_arc_runtime))
- Opts.ObjCNoAutoRefCountRuntime = 1;
}
+ if (Args.hasArg(OPT_fobjc_runtime_has_weak))
+ Opts.ObjCRuntimeHasWeak = 1;
+
if (Args.hasArg(OPT_fno_objc_infer_related_result_type))
Opts.ObjCInferRelatedResultType = 0;
}