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/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 012e256..b47d627 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -592,7 +592,7 @@
PropertyIvarType = Context.getQualifiedType(PropertyIvarType, qs);
}
else if (kind & ObjCPropertyDecl::OBJC_PR_weak) {
- if (getLangOptions().ObjCNoAutoRefCountRuntime) {
+ if (!getLangOptions().ObjCRuntimeHasWeak) {
Diag(PropertyLoc, diag::err_arc_weak_no_runtime);
Diag(property->getLocation(), diag::note_property_declare);
}
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 3f211da..1418422 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -3191,9 +3191,9 @@
type = S.Context.getAttributedType(AttributedType::attr_objc_ownership,
origType, type);
- // Forbid __weak if we don't have a runtime.
+ // Forbid __weak if the runtime doesn't support it.
if (lifetime == Qualifiers::OCL_Weak &&
- S.getLangOptions().ObjCNoAutoRefCountRuntime) {
+ !S.getLangOptions().ObjCRuntimeHasWeak) {
// Actually, delay this until we know what we're parsing.
if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {