[OpenCL] Fix assertion due to blocks
authorYaxun Liu <Yaxun.Liu@amd.com>
Tue, 26 Feb 2019 16:20:41 +0000 (16:20 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Tue, 26 Feb 2019 16:20:41 +0000 (16:20 +0000)
commitd83c74028db0e3991a7c33c890439a608822f69f
treea60073a23e07bc0c54bf23efd78019796c1d6b73
parent46c719ddcd17a483554c491ba1db817c11f01f28
[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

llvm-svn: 354893
clang/lib/AST/Expr.cpp
clang/test/CodeGenOpenCL/blocks.cl