summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-06-20 06:18:46 +0000
committerJohn McCall <rjmccall@apple.com>2012-06-20 06:18:46 +0000
commit5fb5df9c8385c3c86fe3d31fbac5766217168a9b (patch)
treed0aa1ee58ae92997f1aa7af1556fb7cda32f3173 /clang/lib/Frontend/CompilerInvocation.cpp
parentb9e8e189497ef4a690c913b09ce6a8ff03281c60 (diff)
downloadbcm5719-llvm-5fb5df9c8385c3c86fe3d31fbac5766217168a9b.tar.gz
bcm5719-llvm-5fb5df9c8385c3c86fe3d31fbac5766217168a9b.zip
Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 6f55a02550d..8a95c80e49f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -206,10 +206,6 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts, ToArgsList &Res) {
Res.push_back("-fdebug-compilation-dir", Opts.DebugCompilationDir);
if (!Opts.DwarfDebugFlags.empty())
Res.push_back("-dwarf-debug-flags", Opts.DwarfDebugFlags);
- if (Opts.ObjCRuntimeHasARC)
- Res.push_back("-fobjc-runtime-has-arc");
- if (Opts.ObjCRuntimeHasTerminate)
- Res.push_back("-fobjc-runtime-has-terminate");
if (Opts.EmitGcovArcs)
Res.push_back("-femit-coverage-data");
if (Opts.EmitGcovNotes)
@@ -678,8 +674,6 @@ static void LangOptsToArgs(const LangOptions &Opts, ToArgsList &Res) {
Res.push_back("-fmsc-version=" + llvm::utostr(Opts.MSCVersion));
if (Opts.Borland)
Res.push_back("-fborland-extensions");
- if (!Opts.ObjCNonFragileABI)
- Res.push_back("-fobjc-fragile-abi");
if (Opts.ObjCDefaultSynthProperties)
Res.push_back("-fobjc-default-synthesize-properties");
// NoInline is implicit.
@@ -715,8 +709,6 @@ static void LangOptsToArgs(const LangOptions &Opts, ToArgsList &Res) {
Res.push_back("-fno-rtti");
if (Opts.MSBitfields)
Res.push_back("-mms-bitfields");
- if (!Opts.NeXTRuntime)
- Res.push_back("-fgnu-runtime");
if (Opts.Freestanding)
Res.push_back("-ffreestanding");
if (Opts.NoBuiltin)
@@ -786,6 +778,7 @@ static void LangOptsToArgs(const LangOptions &Opts, ToArgsList &Res) {
Res.push_back("-fobjc-gc-only");
}
}
+ Res.push_back("-fobjc-runtime=" + Opts.ObjCRuntime.getAsString());
if (Opts.ObjCAutoRefCount)
Res.push_back("-fobjc-arc");
if (Opts.ObjCRuntimeHasWeak)
@@ -1190,8 +1183,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
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.ObjCRuntimeHasTerminate = Args.hasArg(OPT_fobjc_runtime_has_terminate);
Opts.CUDAIsDevice = Args.hasArg(OPT_fcuda_is_device);
Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
@@ -1880,16 +1871,23 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.CXXOperatorNames = 0;
if (Opts.ObjC1) {
+ if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
+ StringRef value = arg->getValue(Args);
+ if (Opts.ObjCRuntime.tryParse(value))
+ Diags.Report(diag::err_drv_unknown_objc_runtime) << value;
+ }
+
if (Args.hasArg(OPT_fobjc_gc_only))
Opts.setGC(LangOptions::GCOnly);
else if (Args.hasArg(OPT_fobjc_gc))
Opts.setGC(LangOptions::HybridGC);
else if (Args.hasArg(OPT_fobjc_arc)) {
Opts.ObjCAutoRefCount = 1;
- if (Args.hasArg(OPT_fobjc_fragile_abi))
+ if (!Opts.ObjCRuntime.isNonFragile())
Diags.Report(diag::err_arc_nonfragile_abi);
}
+ Opts.ObjCRuntimeHasWeak = Opts.ObjCRuntime.hasWeak();
if (Args.hasArg(OPT_fobjc_runtime_has_weak))
Opts.ObjCRuntimeHasWeak = 1;
@@ -1992,12 +1990,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.NumLargeByValueCopy = Args.getLastArgIntValue(OPT_Wlarge_by_value_copy_EQ,
0, Diags);
Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields);
- Opts.NeXTRuntime = !Args.hasArg(OPT_fgnu_runtime);
Opts.ObjCConstantStringClass =
Args.getLastArgValue(OPT_fconstant_string_class);
- Opts.ObjCNonFragileABI = !Args.hasArg(OPT_fobjc_fragile_abi);
- if (Opts.ObjCNonFragileABI)
- Opts.ObjCNonFragileABI2 = true;
Opts.ObjCDefaultSynthProperties =
Args.hasArg(OPT_fobjc_default_synthesize_properties);
Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior);
OpenPOWER on IntegriCloud