From 8a6b859dbc103eda94a2df347385ccc553a8d081 Mon Sep 17 00:00:00 2001 From: Joey Gouly Date: Wed, 9 Aug 2017 14:52:47 +0000 Subject: [PATCH] [OpenCL] Minor refactoring to reduce copy/pasted code Set the type of TheCall inside SemaBuiltinReserveRWPipe to reduce duplicated code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310477 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaChecking.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index bbb4b7592e..0112bffa29 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -683,6 +683,11 @@ static bool SemaBuiltinReserveRWPipe(Sema &S, CallExpr *Call) { return true; } + // Since return type of reserve_read/write_pipe built-in function is + // reserve_id_t, which is not defined in the builtin def file , we used int + // as return type and need to override the return type of these functions. + Call->setType(S.Context.OCLReserveIDTy); + return false; } @@ -1086,20 +1091,12 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BIwork_group_reserve_write_pipe: if (SemaBuiltinReserveRWPipe(*this, TheCall)) return ExprError(); - // Since return type of reserve_read/write_pipe built-in function is - // reserve_id_t, which is not defined in the builtin def file , we used int - // as return type and need to override the return type of these functions. - TheCall->setType(Context.OCLReserveIDTy); break; case Builtin::BIsub_group_reserve_read_pipe: case Builtin::BIsub_group_reserve_write_pipe: if (checkOpenCLSubgroupExt(*this, TheCall) || SemaBuiltinReserveRWPipe(*this, TheCall)) return ExprError(); - // Since return type of reserve_read/write_pipe built-in function is - // reserve_id_t, which is not defined in the builtin def file , we used int - // as return type and need to override the return type of these functions. - TheCall->setType(Context.OCLReserveIDTy); break; case Builtin::BIcommit_read_pipe: case Builtin::BIcommit_write_pipe: -- 2.40.0