summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-27 22:38:11 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-27 22:38:11 +0000
commitf5c1c923e8fd963d048c0bb14d43c25e4bf87e23 (patch)
tree806f217fc8de18deebf3539e576bf8c63205d8ee /clang/lib/Sema/SemaDeclObjC.cpp
parentc08336adc36bef512bb561fe31b92cb82e2fd1dd (diff)
downloadbcm5719-llvm-f5c1c923e8fd963d048c0bb14d43c25e4bf87e23.tar.gz
bcm5719-llvm-f5c1c923e8fd963d048c0bb14d43c25e4bf87e23.zip
Diagnose gc attribute mismatch of property and its ivar.
llvm-svn: 65656
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index cb35890b3f1..dc30ac2ea90 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1751,6 +1751,18 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
<< property->getDeclName() << Ivar->getDeclName();
return 0;
}
+ // __weak is explicit. So it works on Canonical type.
+ if (PropType.isObjCGCWeak() && !IvarType.isObjCGCWeak()) {
+ Diag(PropertyLoc, diag::error_weak_property)
+ << property->getDeclName() << Ivar->getDeclName();
+ return 0;
+ }
+ if ((Context.isObjCObjectPointerType(property->getType()) ||
+ PropType.isObjCGCStrong()) && IvarType.isObjCGCWeak()) {
+ Diag(PropertyLoc, diag::error_strong_property)
+ << property->getDeclName() << Ivar->getDeclName();
+ return 0;
+ }
}
}
} else if (PropertyIvar) {
OpenPOWER on IntegriCloud