aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-06-28 16:39:28 +0000
committerJordan Rose <jordan_rose@apple.com>2012-06-28 16:39:28 +0000
commit0239df868e2e09f4963bc310c56ea129f51a2288 (patch)
treefaf72f41eedec6550d8dddd31b0c68a73285101f /lib/Sema
parent8376f5934a18b950ac7323d8a38ed231623010fa (diff)
Warn on weak properties declared in protocols as well.
Previously this caused a crash, since protocols are not interfaces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaExprObjC.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 598ad0b27a..a3fe7d3bbe 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -1379,10 +1379,12 @@ static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) {
ObjCMethodDecl *Method = ME->getMethodDecl();
if (Method && Method->isSynthesized()) {
Selector Sel = Method->getSelector();
- if (Sel.getNumArgs() == 0)
+ if (Sel.getNumArgs() == 0) {
+ const DeclContext *Container = Method->getDeclContext();
PDecl =
- S.LookupPropertyDecl(Method->getClassInterface(),
+ S.LookupPropertyDecl(cast<ObjCContainerDecl>(Container),
Sel.getIdentifierInfoForSlot(0));
+ }
if (PDecl)
T = PDecl->getType();
}