]> granicus.if.org Git - clang/commitdiff
Now that we have __weak defined as attribute in all modes,
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 7 Apr 2009 21:25:06 +0000 (21:25 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 7 Apr 2009 21:25:06 +0000 (21:25 +0000)
we must not issue gc-specific errors in non-gc mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68551 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/no-gc-weak-test.m [new file with mode: 0644]

index 17de0a506786d51888bd20fadf0e29b20175bb2b..e1583d75b40d34727ffc14b9a62b48c507588638 100644 (file)
@@ -1825,7 +1825,8 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
         return DeclPtrTy();
       }
       // __weak is explicit. So it works on Canonical type.
-      if (PropType.isObjCGCWeak() && !IvarType.isObjCGCWeak()) {
+      if (PropType.isObjCGCWeak() && !IvarType.isObjCGCWeak() &&
+          getLangOptions().getGCMode() != LangOptions::NonGC) {
         Diag(PropertyLoc, diag::error_weak_property)
         << property->getDeclName() << Ivar->getDeclName();
         return DeclPtrTy();
diff --git a/test/SemaObjC/no-gc-weak-test.m b/test/SemaObjC/no-gc-weak-test.m
new file mode 100644 (file)
index 0000000..e762c05
--- /dev/null
@@ -0,0 +1,14 @@
+// RUN: clang-cc  -fsyntax-only -verify %s
+
+@interface Subtask
+{
+  id _delegate;
+}
+@property(nonatomic,readwrite,assign)   id __weak       delegate;
+@end
+
+@implementation Subtask
+@synthesize delegate = _delegate;
+@end
+