[cfe-commits] r143975 - in /cfe/trunk: lib/Sema/SemaType.cpp test/SemaObjC/arc-no-runtime.m

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Nov 7 10:40:21 PST 2011


Author: akirtzidis
Date: Mon Nov  7 12:40:21 2011
New Revision: 143975

URL: http://llvm.org/viewvc/llvm-project?rev=143975&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/SemaObjC/arc-no-runtime.m

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=143975&r1=143974&r2=143975&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Nov  7 12:40:21 2011
@@ -3341,7 +3341,7 @@
 
   // 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()) {

Modified: cfe/trunk/test/SemaObjC/arc-no-runtime.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-no-runtime.m?rev=143975&r1=143974&r2=143975&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-no-runtime.m (original)
+++ cfe/trunk/test/SemaObjC/arc-no-runtime.m Mon Nov  7 12:40:21 2011
@@ -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





More information about the cfe-commits mailing list