aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-07-06 19:24:05 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-07-06 19:24:05 +0000
commit742352a3984aeef9ecf911be23e673e97b34595f (patch)
tree4f141cec6da088938a8f01c536576bc6ad254f33 /lib/Sema/SemaDeclAttr.cpp
parentc41b878b24bf9619d5351b05d7088221dfbe9447 (diff)
objc-arc: Support objc_arc_weak_unavailable on those
classes which are incompatible with weak references. // rdar://9693477 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 103976bc12..adef528b0a 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1091,6 +1091,18 @@ static void handleUnavailableAttr(Sema &S, Decl *D, const AttributeList &Attr) {
D->addAttr(::new (S.Context) UnavailableAttr(Attr.getLoc(), S.Context, Str));
}
+static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D,
+ const AttributeList &Attr) {
+ unsigned NumArgs = Attr.getNumArgs();
+ if (NumArgs > 0) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
+ return;
+ }
+
+ D->addAttr(::new (S.Context) ArcWeakrefUnavailableAttr(
+ Attr.getLoc(), S.Context));
+}
+
static void handleAvailabilityAttr(Sema &S, Decl *D,
const AttributeList &Attr) {
IdentifierInfo *Platform = Attr.getParameterName();
@@ -3011,6 +3023,9 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
case AttributeList::AT_MsStruct: handleMsStructAttr (S, D, Attr); break;
case AttributeList::AT_section: handleSectionAttr (S, D, Attr); break;
case AttributeList::AT_unavailable: handleUnavailableAttr (S, D, Attr); break;
+ case AttributeList::AT_arc_weakref_unavailable:
+ handleArcWeakrefUnavailableAttr (S, D, Attr);
+ break;
case AttributeList::AT_unused: handleUnusedAttr (S, D, Attr); break;
case AttributeList::AT_used: handleUsedAttr (S, D, Attr); break;
case AttributeList::AT_visibility: handleVisibilityAttr (S, D, Attr); break;