aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-04-07 21:25:06 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-04-07 21:25:06 +0000
commitc8bafd7242763b7029a7bed898690ea44a59ae4a (patch)
tree2af855d732c9752fafa60c92bbb2207266a7dde6
parent48d1ef782c8c88066b5febf60f8f456064d7d3f0 (diff)
Now that we have __weak defined as attribute in all modes,
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
-rw-r--r--lib/Sema/SemaDeclObjC.cpp3
-rw-r--r--test/SemaObjC/no-gc-weak-test.m14
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 17de0a5067..e1583d75b4 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -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
index 0000000000..e762c05815
--- /dev/null
+++ b/test/SemaObjC/no-gc-weak-test.m
@@ -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
+
+