[OpenCL] Add Sema checks for OpenCL 2.0 block
Summary: Add Sema checks for opencl 2.0 new features: Block. This patch is partitioned from http://reviews.llvm.org/D16047 Reviewers: Anastasia Subscribers: pekka.jaaskelainen, cfe-commits Differential Revision: http://reviews.llvm.org/D17436 llvm-svn: 261719
This commit is contained in:
@@ -6708,6 +6708,19 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
|
||||
NewVD->setInvalidDecl();
|
||||
return;
|
||||
}
|
||||
|
||||
// OpenCL v2.0 s6.12.5 - Blocks with variadic arguments are not supported.
|
||||
if (LangOpts.OpenCL && T->isBlockPointerType()) {
|
||||
const BlockPointerType *BlkTy = T->getAs<BlockPointerType>();
|
||||
const FunctionProtoType *FTy =
|
||||
BlkTy->getPointeeType()->getAs<FunctionProtoType>();
|
||||
if (FTy->isVariadic()) {
|
||||
Diag(NewVD->getLocation(), diag::err_opencl_block_proto_variadic)
|
||||
<< T << NewVD->getSourceRange();
|
||||
NewVD->setInvalidDecl();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// \brief Perform semantic checking on a newly-created variable
|
||||
|
||||
Reference in New Issue
Block a user