Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Sema/SemaDecl.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 6,810 Lines • ▼ Show 20 Lines | |||||
/// Returns true if there hasn't been any invalid type diagnosed. | /// Returns true if there hasn't been any invalid type diagnosed. | ||||
static bool diagnoseOpenCLTypes(Sema &Se, VarDecl *NewVD) { | static bool diagnoseOpenCLTypes(Sema &Se, VarDecl *NewVD) { | ||||
DeclContext *DC = NewVD->getDeclContext(); | DeclContext *DC = NewVD->getDeclContext(); | ||||
QualType R = NewVD->getType(); | QualType R = NewVD->getType(); | ||||
// OpenCL v2.0 s6.9.b - Image type can only be used as a function argument. | // OpenCL v2.0 s6.9.b - Image type can only be used as a function argument. | ||||
// OpenCL v2.0 s6.13.16.1 - Pipe type can only be used as a function | // OpenCL v2.0 s6.13.16.1 - Pipe type can only be used as a function | ||||
// argument. | // argument. | ||||
if (R->isImageType() || R->isPipeType()) { | if (!R->isSampledImageType() && (R->isImageType() || R->isPipeType())) { | ||||
Se.Diag(NewVD->getLocation(), | Se.Diag(NewVD->getLocation(), | ||||
diag::err_opencl_type_can_only_be_used_as_function_parameter) | diag::err_opencl_type_can_only_be_used_as_function_parameter) | ||||
<< R; | << R; | ||||
NewVD->setInvalidDecl(); | NewVD->setInvalidDecl(); | ||||
return false; | return false; | ||||
} | } | ||||
// OpenCL v1.2 s6.9.r: | // OpenCL v1.2 s6.9.r: | ||||
▲ Show 20 Lines • Show All 11,766 Lines • Show Last 20 Lines |