summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-07 18:40:21 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-07 18:40:21 +0000
commitfed29142bad78baf6034e01d1843c16e89cdbc1a (patch)
treeeacb5ddb9b54149403483d8a9aba778e35d00e5c
parent2c5dab541d14677d3c85acb3497aa12ce3f8130a (diff)
downloadbcm5719-llvm-fed29142bad78baf6034e01d1843c16e89cdbc1a.tar.gz
bcm5719-llvm-fed29142bad78baf6034e01d1843c16e89cdbc1a.zip
When applying ARC __weak to a non-objc pointer, do not give error that
__weak is unsupported by the deployment target, since it is going to be ignored anyway. Makes it easier for incremental migration from GC. llvm-svn: 143975
-rw-r--r--clang/lib/Sema/SemaType.cpp2
-rw-r--r--clang/test/SemaObjC/arc-no-runtime.m1
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 219a9e8a308..4dc6c949d59 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -3341,7 +3341,7 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state,
// Forbid __weak if the runtime doesn't support it.
if (lifetime == Qualifiers::OCL_Weak &&
- !S.getLangOptions().ObjCRuntimeHasWeak) {
+ !S.getLangOptions().ObjCRuntimeHasWeak && !NonObjCPointer) {
// Actually, delay this until we know what we're parsing.
if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
diff --git a/clang/test/SemaObjC/arc-no-runtime.m b/clang/test/SemaObjC/arc-no-runtime.m
index 49c439b1676..567dc68cd68 100644
--- a/clang/test/SemaObjC/arc-no-runtime.m
+++ b/clang/test/SemaObjC/arc-no-runtime.m
@@ -3,6 +3,7 @@
// rdar://problem/9150784
void test(void) {
__weak id x; // expected-error {{the current deployment target does not support automated __weak references}}
+ __weak void *v; // expected-warning {{'__weak' only applies to objective-c object or block pointer types}}
}
@interface A
OpenPOWER on IntegriCloud