summaryrefslogtreecommitdiffstats
path: root/clang/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
commit05e916bc95946d5c486d0a8502f6697fe49289b1 (patch)
tree60b528ebe6038c4a2c7d6b7dddc98ef863a3c1e5 /clang/lib/Sema/SemaDeclAttr.cpp
parent2fc34c5f847adc68529d4786becd48459b79a0a6 (diff)
downloadbcm5719-llvm-05e916bc95946d5c486d0a8502f6697fe49289b1.tar.gz
bcm5719-llvm-05e916bc95946d5c486d0a8502f6697fe49289b1.zip
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>.
llvm-svn: 151786
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index f0fcd6e91c2..4f3b03f6e51 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/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));
}
OpenPOWER on IntegriCloud