summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorXiuli Pan <xiulipan@outlook.com>2016-03-30 04:46:32 +0000
committerXiuli Pan <xiulipan@outlook.com>2016-03-30 04:46:32 +0000
commit0a1c6c2ee5cf889dcbd4f8f1657955bb9fc8a7c7 (patch)
treec3854a21e1f8ce6080324ee00550300c981edb94 /clang/lib/Sema
parent62f0576c5c9f691ae008710b42c9dc372618385c (diff)
downloadbcm5719-llvm-0a1c6c2ee5cf889dcbd4f8f1657955bb9fc8a7c7.tar.gz
bcm5719-llvm-0a1c6c2ee5cf889dcbd4f8f1657955bb9fc8a7c7.zip
[OpenCL] Fix pipe builtin bugs
Summary: 1. Diag should be output if types are not the same. 2. Should compare using canonical type. 3. Refine the diag to be more clear. Reviewers: yaxunl, Anastasia Subscribers: MatsPetersson, pekka.jaaskelainen, cfe-commits Differential Revision: http://reviews.llvm.org/D17955 llvm-svn: 264825
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 062041e3771..6f9060be84c 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -325,10 +325,12 @@ static bool checkOpenCLPipePacketType(Sema &S, CallExpr *Call, unsigned Idx) {
const PointerType *ArgTy = ArgIdx->getType()->getAs<PointerType>();
// The Idx argument should be a pointer and the type of the pointer and
// the type of pipe element should also be the same.
- if (!ArgTy || S.Context.hasSameType(EltTy, ArgTy->getPointeeType())) {
+ if (!ArgTy ||
+ !S.Context.hasSameType(
+ EltTy, ArgTy->getPointeeType()->getCanonicalTypeInternal())) {
S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.getPointerType(EltTy)
- << ArgIdx->getSourceRange();
+ << ArgIdx->getType() << ArgIdx->getSourceRange();
return true;
}
return false;
@@ -361,7 +363,7 @@ static bool SemaBuiltinRWPipe(Sema &S, CallExpr *Call) {
if (!Call->getArg(1)->getType()->isReserveIDT()) {
S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.OCLReserveIDTy
- << Call->getArg(1)->getSourceRange();
+ << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
return true;
}
@@ -371,7 +373,7 @@ static bool SemaBuiltinRWPipe(Sema &S, CallExpr *Call) {
!Arg2->getType()->isUnsignedIntegerType()) {
S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.UnsignedIntTy
- << Arg2->getSourceRange();
+ << Arg2->getType() << Arg2->getSourceRange();
return true;
}
@@ -405,7 +407,7 @@ static bool SemaBuiltinReserveRWPipe(Sema &S, CallExpr *Call) {
!Call->getArg(1)->getType()->isUnsignedIntegerType()) {
S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.UnsignedIntTy
- << Call->getArg(1)->getSourceRange();
+ << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
return true;
}
@@ -428,7 +430,7 @@ static bool SemaBuiltinCommitRWPipe(Sema &S, CallExpr *Call) {
if (!Call->getArg(1)->getType()->isReserveIDT()) {
S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.OCLReserveIDTy
- << Call->getArg(1)->getSourceRange();
+ << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
return true;
}
OpenPOWER on IntegriCloud