summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-06 00:26:06 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-06 00:26:06 +0000
commit24fc0decfe337258a3dacc7936a9da84e2406cdc (patch)
treee91ae1686c100a1cadcdc577c82e30c052f93ee6 /clang/lib/Frontend
parentaf51b1f7096578431578d6a1430366f7ad365430 (diff)
downloadbcm5719-llvm-24fc0decfe337258a3dacc7936a9da84e2406cdc.tar.gz
bcm5719-llvm-24fc0decfe337258a3dacc7936a9da84e2406cdc.zip
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. llvm-svn: 134453
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp12
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp4
2 files changed, 10 insertions, 6 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 12e51a61e1f..31c86432b75 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -123,6 +123,8 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
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 @@ static void LangOptsToArgs(const LangOptions &Opts,
}
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 @@ static void 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.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 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
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;
}
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index b07fb4395fa..9428cd5de0f 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -250,7 +250,7 @@ static void AddObjCXXARCLibcxxDefines(const LangOptions &LangOpts,
<< "}\n"
<< "\n";
- if (!LangOpts.ObjCNoAutoRefCountRuntime) {
+ if (LangOpts.ObjCRuntimeHasWeak) {
Out << "template <class _Tp>\n"
<< "inline __attribute__ ((__visibility__(\"hidden\"),"
<< "__always_inline__))\n"
@@ -318,7 +318,7 @@ static void AddObjCXXARCLibstdcxxDefines(const LangOptions &LangOpts,
<< "};\n"
<< "\n";
- if (!LangOpts.ObjCNoAutoRefCountRuntime) {
+ if (LangOpts.ObjCRuntimeHasWeak) {
Out << "template<typename _Tp>\n"
<< "struct __is_scalar<__attribute__((objc_ownership(weak))) _Tp> {\n"
<< " enum { __value = 0 };\n"
OpenPOWER on IntegriCloud