forked from OSchip/llvm-project
Be slightly more permissive when checking for type-erased blocks.
This is a patch from Doug that was inadvertently omitted from r241543. llvm-svn: 249116
This commit is contained in:
parent
fdbbd25d0d
commit
7e9fd56b26
|
@ -1657,7 +1657,8 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
|
|||
// 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();
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue