r249116 - Be slightly more permissive when checking for type-erased blocks.

Bob Wilson via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 18:05:29 PDT 2015


Author: bwilson
Date: Thu Oct  1 20:05:29 2015
New Revision: 249116

URL: http://llvm.org/viewvc/llvm-project?rev=249116&view=rev
Log:
Be slightly more permissive when checking for type-erased blocks.

This is a patch from Doug that was inadvertently omitted from r241543.

Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/CodeGenObjC/parameterized_classes.m

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=249116&r1=249115&r2=249116&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu Oct  1 20:05:29 2015
@@ -1657,7 +1657,8 @@ bool Sema::CheckMessageArgumentTypes(Qua
       // Objective-C pointer type, we may need to extend the lifetime
       // of the block object.
       if (typeArgs && Args[i]->isRValue() && paramType->isBlockPointerType() &&
-          origParamType->isBlockCompatibleObjCPointerType(Context)) {
+          Args[i]->getType()->isBlockPointerType() &&
+          origParamType->isObjCObjectPointerType()) {
         ExprResult arg = Args[i];
         maybeExtendBlockObject(arg);
         Args[i] = arg.get();

Modified: cfe/trunk/test/CodeGenObjC/parameterized_classes.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/parameterized_classes.m?rev=249116&r1=249115&r2=249116&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/parameterized_classes.m (original)
+++ cfe/trunk/test/CodeGenObjC/parameterized_classes.m Thu Oct  1 20:05:29 2015
@@ -24,6 +24,8 @@ __attribute__((objc_root_class))
 - (void)addObject:(T)object;
 - (void)sortWithFunction:(int (*)(T, T))function;
 - (void)getObjects:(T __strong *)objects length:(unsigned*)length;
+- (T)objectAtIndexedSubscript:(unsigned)index;
+- (void)setObject:(T)object atIndexedSubscript:(unsigned)index;
 @end
 
 NSString *getFirstObjectProp(NSMutableArray<NSString *> *array) {
@@ -58,6 +60,11 @@ void printMe(NSString *name) { }
 
 // CHECK-LABEL: define void @blockTest
 void blockTest(NSMutableArray<void (^)(void)> *array, NSString *name) {
+  // CHECK-NOT: ret void
   // CHECK: call i8* @objc_retainBlock
   [array addObject: ^ { printMe(name); }];
+  // CHECK-NOT: ret void
+  array[0] = ^ { printMe(name); };
+  // CHECK: call i8* @objc_retainBlock
+  // CHECK: ret void
 }




More information about the cfe-commits mailing list