[PATCH] D58658: [OpenCL] Fix assertion due to blocks

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 26 08:20:02 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC354893: [OpenCL] Fix assertion due to blocks (authored by yaxunl, committed by ).
Herald added a project: clang.

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58658/new/

https://reviews.llvm.org/D58658

Files:
  lib/AST/Expr.cpp
  test/CodeGenOpenCL/blocks.cl


Index: test/CodeGenOpenCL/blocks.cl
===================================================================
--- test/CodeGenOpenCL/blocks.cl
+++ test/CodeGenOpenCL/blocks.cl
@@ -90,6 +90,12 @@
   return blockArgFunc(^{return 42;});
 }
 
+// COMMON-LABEL: define {{.*}}@call_block
+// call {{.*}}@__call_block_block_invoke
+int call_block() {
+  return ^int(int num) { return num; } (11);
+}
+
 // CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__size"
 // CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__align"
 
Index: lib/AST/Expr.cpp
===================================================================
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -1358,6 +1358,8 @@
     return DRE->getDecl();
   if (MemberExpr *ME = dyn_cast<MemberExpr>(CEE))
     return ME->getMemberDecl();
+  if (auto *BE = dyn_cast<BlockExpr>(CEE))
+    return BE->getBlockDecl();
 
   return nullptr;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58658.188381.patch
Type: text/x-patch
Size: 894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190226/d5ad6482/attachment-0001.bin>


More information about the cfe-commits mailing list