summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ASTContext.cpp2
-rw-r--r--clang/test/CodeGenObjC/objc2-strong-cast-4.m13
2 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index bf1fac9eec1..84a5195a60e 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -3391,7 +3391,7 @@ QualType::GCAttrTypes ASTContext::getObjCGCAttrKind(const QualType &Ty) const {
// (or pointers to them) be treated as though they were declared
// as __strong.
if (GCAttrs == QualType::GCNone) {
- if (Ty->isObjCObjectPointerType())
+ if (Ty->isObjCObjectPointerType() || Ty->isBlockPointerType())
GCAttrs = QualType::Strong;
else if (Ty->isPointerType())
return getObjCGCAttrKind(Ty->getAs<PointerType>()->getPointeeType());
diff --git a/clang/test/CodeGenObjC/objc2-strong-cast-4.m b/clang/test/CodeGenObjC/objc2-strong-cast-4.m
index 350b2b0beda..6603e324657 100644
--- a/clang/test/CodeGenObjC/objc2-strong-cast-4.m
+++ b/clang/test/CodeGenObjC/objc2-strong-cast-4.m
@@ -1,5 +1,5 @@
// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
-// RUN: grep objc_assign_strongCast %t | count 7 &&
+// RUN: grep objc_assign_strongCast %t | count 8 &&
// RUN: true
struct Slice {
@@ -14,6 +14,14 @@ typedef struct Slice Slice;
}
@end
+typedef void (^observer_block_t)(id object);
+@interface Observer {
+@public
+ observer_block_t block;
+}
+@end
+
+
void foo (int i) {
// storing into an array of strong pointer types.
void *__strong* items;
@@ -32,4 +40,7 @@ void foo (int i) {
islice->IvarItem = 0;
// Storing into an ivar of an array of strong pointer types.
islice->IvarItem[i] = (void*)0;
+
+ Observer *observer;
+ observer->block = 0;
}
OpenPOWER on IntegriCloud