[cfe-commits] r45709 - in /cfe/trunk: Sema/Sema.cpp test/Parser/objc-forcollection-neg-2.m

Fariborz Jahanian fjahanian at apple.com
Mon Jan 7 10:14:05 PST 2008


Author: fjahanian
Date: Mon Jan  7 12:14:04 2008
New Revision: 45709

URL: http://llvm.org/viewvc/llvm-project?rev=45709&view=rev
Log:
Limit type of foreach's element and collection to be a pointer to 
objc object type.

Modified:
    cfe/trunk/Sema/Sema.cpp
    cfe/trunk/test/Parser/objc-forcollection-neg-2.m

Modified: cfe/trunk/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.cpp?rev=45709&r1=45708&r2=45709&view=diff

==============================================================================
--- cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/trunk/Sema/Sema.cpp Mon Jan  7 12:14:04 2008
@@ -33,7 +33,7 @@
       type->isObjcQualifiedIdType())
     return true;
   
-  while (type->isPointerType()) {
+  if (type->isPointerType()) {
     PointerType *pointerType = static_cast<PointerType*>(type.getTypePtr());
     type = pointerType->getPointeeType();
   }

Modified: cfe/trunk/test/Parser/objc-forcollection-neg-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-forcollection-neg-2.m?rev=45709&r1=45708&r2=45709&view=diff

==============================================================================
--- cfe/trunk/test/Parser/objc-forcollection-neg-2.m (original)
+++ cfe/trunk/test/Parser/objc-forcollection-neg-2.m Mon Jan  7 12:14:04 2008
@@ -30,7 +30,7 @@
         for (id el in self) 
            ++i;
 	MyList<P> ***p;
-        for (p in self) 
+        for (p in self)  // expected-error {{selector element is not of valid object type (its type is 'MyList<P> ***')}}
            ++i;
 
 }





More information about the cfe-commits mailing list