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

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Sep 20 16:49:22 PDT 2011


Author: akirtzidis
Date: Tue Sep 20 18:49:22 2011
New Revision: 140212

URL: http://llvm.org/viewvc/llvm-project?rev=140212&view=rev
Log:
[ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.

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

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=140212&r1=140211&r2=140212&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue Sep 20 18:49:22 2011
@@ -1038,6 +1038,11 @@
   } else if (type->isObjCARCImplicitlyUnretainedType()) {
     implicitLifetime = Qualifiers::OCL_ExplicitNone;
 
+  // If we are in an unevaluated context, like sizeof, assume ExplicitNone and
+  // don't give error.
+  } else if (S.ExprEvalContexts.back().Context == Sema::Unevaluated) {
+    implicitLifetime = Qualifiers::OCL_ExplicitNone;
+
   // If that failed, give an error and recover using __autoreleasing.
   } else {
     // These types can show up in private ivars in system headers, so

Modified: cfe/trunk/test/SemaObjC/arc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc.m?rev=140212&r1=140211&r2=140212&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc.m (original)
+++ cfe/trunk/test/SemaObjC/arc.m Tue Sep 20 18:49:22 2011
@@ -646,6 +646,8 @@
   for (id y in c) { // expected-error {{collection expression type 'Test37' is a forward declaration}}
     (void) y;
   }
+
+  (void)sizeof(id*); // no error.
 }
 
 // rdar://problem/9887979





More information about the cfe-commits mailing list