[PATCH] D58514: Avoid needlessly copying blocks that initialize or are assigned to local auto variables to the heap
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 13 16:13:26 PDT 2019
ahatanak added a comment.
Seems like the chromium code is valid and shouldn't crash. John/Erik what do you think? The following code also crashes with this patch applied.
typedef void (^BlockTy)();
BlockTy sb;
__weak BlockTy wb;
void foo(id a) {
auto b = ^{ NSLog(@"foo %@", a); };
wb = b; // block isn't copied to the heap.
sb = b; // block is copied to the heap.
}
int main() {
auto x = [NSObject new];
foo(x);
sb();
wb();
return 0;
}
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58514/new/
https://reviews.llvm.org/D58514
More information about the cfe-commits
mailing list