[OpenCL] Fix pipe built-in functions return type.
By default return type of call expressions calling built-in
functions is set to bool.
Fixes https://llvm.org/bugs/show_bug.cgi?id=30219.
Reviewers: Anastasia
Subscribers: dmitry, cfe-commits, yaxunl
Differential Revision: https://reviews.llvm.org/D24136
llvm-svn: 280800
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 6edb251..81dc237 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -1020,6 +1020,7 @@
// check for the argument.
if (SemaBuiltinRWPipe(*this, TheCall))
return ExprError();
+ TheCall->setType(Context.IntTy);
break;
case Builtin::BIreserve_read_pipe:
case Builtin::BIreserve_write_pipe:
@@ -1047,6 +1048,7 @@
case Builtin::BIget_pipe_max_packets:
if (SemaBuiltinPipePackets(*this, TheCall))
return ExprError();
+ TheCall->setType(Context.UnsignedIntTy);
break;
case Builtin::BIto_global:
case Builtin::BIto_local: