aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-03-01 01:40:32 +0000
committerTed Kremenek <kremenek@apple.com>2012-03-01 01:40:32 +0000
commitf6e88d7592a5b5ab19890a41ff71f5bf8ca2a9fa (patch)
treeb167c863811ee74f714b218ed10c06598b84d0e6 /lib/Sema/SemaDeclAttr.cpp
parent3edf02f66d339a3ae6d06aeb96c78d9089b53bc1 (diff)
Fix regression from llvm-gcc where we should NOT emit a warning about __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index f0fcd6e91c..4f3b03f6e5 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1794,8 +1794,15 @@ static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) {
return;
}
}
- else
+ else if (!isa<ObjCPropertyDecl>(D)) {
+ // It is okay to include this attribute on properties, e.g.:
+ //
+ // @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
+ //
+ // In this case it follows tradition and suppresses an error in the above
+ // case.
S.Diag(D->getLocation(), diag::warn_nsobject_attribute);
+ }
D->addAttr(::new (S.Context) ObjCNSObjectAttr(Attr.getRange(), S.Context));
}