diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-27 22:38:11 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-27 22:38:11 +0000 |
commit | 9bc77b2423e75b9361f597d6fa7c024a53e504cd (patch) | |
tree | 82afa3a26f363b3b33cd8e299783d28d32145a3f /lib/Sema/SemaDeclObjC.cpp | |
parent | 173144affecc3f97b73b075c44752aff8cfcfc3a (diff) |
Diagnose gc attribute mismatch of property and its ivar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65656 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index cb35890b3f..dc30ac2ea9 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/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) { |