[PATCH] D43783: [OpenCL] Remove block invoke function from emitted block literal struct
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 24 09:17:13 PDT 2018
yaxunl added a comment.
Herald added a subscriber: jvesely.
In https://reviews.llvm.org/D43783#1204353, @svenvh wrote:
> Sorry for digging up an old commit...
>
> Apparently this broke block arguments, e.g. the following test case:
>
> int foo(int (^ bl)(void)) {
> return bl();
> }
>
> int get21() {
> return foo(^{return 21;});
> }
>
> int get42() {
> return foo(^{return 42;});
> }
>
>
> In particular, the VarDecl that `getBlockExpr()` sees doesn't have an initializer when the called block comes from an argument (causing clang to crash).
Sorry for the delay. I think block should not be allowed as function argument since this generally leads indirect function calls therefore requires support of function pointer. It will rely on optimizations to get rid of indirect function calls.
Repository:
rC Clang
https://reviews.llvm.org/D43783
More information about the cfe-commits
mailing list