aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-01-07 18:14:04 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-01-07 18:14:04 +0000
commit540fc539b9adecc38eec5af3ca59e34be2d12ae1 (patch)
tree1e80f964ddb372e59e4d1c5f44a1eac82eda3fbe
parent8ce5da30642cd23968daf5bc2af5f6cd658c9c16 (diff)
Limit type of foreach's element and collection to be a pointer to
objc object type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45709 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Sema/Sema.cpp2
-rw-r--r--test/Parser/objc-forcollection-neg-2.m2
2 files changed, 2 insertions, 2 deletions
diff --git a/Sema/Sema.cpp b/Sema/Sema.cpp
index 8f340db14e..b33e782077 100644
--- a/Sema/Sema.cpp
+++ b/Sema/Sema.cpp
@@ -33,7 +33,7 @@ bool Sema::isObjcObjectPointerType(QualType type) const {
type->isObjcQualifiedIdType())
return true;
- while (type->isPointerType()) {
+ if (type->isPointerType()) {
PointerType *pointerType = static_cast<PointerType*>(type.getTypePtr());
type = pointerType->getPointeeType();
}
diff --git a/test/Parser/objc-forcollection-neg-2.m b/test/Parser/objc-forcollection-neg-2.m
index 807efd9fa7..ba870aac20 100644
--- a/test/Parser/objc-forcollection-neg-2.m
+++ b/test/Parser/objc-forcollection-neg-2.m
@@ -30,7 +30,7 @@ typedef struct objc_object {
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;
}