diff options
author | Felix Schindler | 2020-09-23 09:13:38 +0000 |
---|---|---|
committer | Felix Schindler | 2020-09-23 13:39:48 +0000 |
commit | 66f28ef57783edc9807b6a75d08c9ebbe53a4d03 (patch) | |
tree | 98ab81ca9696e765ef2fe4be8db374b24cebb0e3 /0003-OpenCL-Fix-assertion-due-to-blocks.patch | |
download | aur-clang8.tar.gz |
[8.0.1-1]
Initialized and adapted from
https://github.com/archlinux/svntogit-packages/raw/d8ffa1f43e5b1d12d1a1980b34bb668c4075892f/trunk/
Diffstat (limited to '0003-OpenCL-Fix-assertion-due-to-blocks.patch')
-rw-r--r-- | 0003-OpenCL-Fix-assertion-due-to-blocks.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/0003-OpenCL-Fix-assertion-due-to-blocks.patch b/0003-OpenCL-Fix-assertion-due-to-blocks.patch new file mode 100644 index 000000000000..ff033cf375af --- /dev/null +++ b/0003-OpenCL-Fix-assertion-due-to-blocks.patch @@ -0,0 +1,57 @@ +From 94a65066cccbe50358dca0a9da7712cf5294912a Mon Sep 17 00:00:00 2001 +From: Yaxun Liu <Yaxun.Liu@amd.com> +Date: Tue, 26 Feb 2019 16:20:41 +0000 +Subject: [PATCH 3/3] [OpenCL] Fix assertion due to blocks + +A recent change caused assertion in CodeGenFunction::EmitBlockCallExpr when a block is called. + +There is code + + Func = CGM.getOpenCLRuntime().getInvokeFunction(E->getCallee()); +getCalleeDecl calls Expr::getReferencedDeclOfCallee, which does not handle +BlockExpr and returns nullptr, which causes isa to assert. + +This patch fixes that. + +Differential Revision: https://reviews.llvm.org/D58658 + + +git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354893 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + lib/AST/Expr.cpp | 2 ++ + test/CodeGenOpenCL/blocks.cl | 6 ++++++ + 2 files changed, 8 insertions(+) + +diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp +index 7cdd3b2c2a..50a65e02bf 100644 +--- a/lib/AST/Expr.cpp ++++ b/lib/AST/Expr.cpp +@@ -1359,6 +1359,8 @@ Decl *Expr::getReferencedDeclOfCallee() { + 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; + } +diff --git a/test/CodeGenOpenCL/blocks.cl b/test/CodeGenOpenCL/blocks.cl +index ab5a2c643c..c3e26855df 100644 +--- a/test/CodeGenOpenCL/blocks.cl ++++ b/test/CodeGenOpenCL/blocks.cl +@@ -90,6 +90,12 @@ int get42() { + 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" + +-- +2.21.0 + |