Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenCL] Test on image access modifiers and image type can only be a …
…type of a function argument. Reviewers: Anastasia Reviewed By: Anastasia Subscribers: yaxunl, cfe-commits, bader Differential Revision: https://reviews.llvm.org/D34980 llvm-svn: 307238
- Loading branch information
Showing
1 changed file
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only | ||
// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only | ||
|
||
void img2d_ro(__read_only image2d_t img) {} // expected-note{{passing argument to parameter 'img' here}} expected-note{{passing argument to parameter 'img' here}} | ||
void img2d_ro(read_only image2d_t); // expected-note 3{{passing argument to parameter here}} | ||
void img2d_wo(write_only image2d_t); // expected-note 2{{passing argument to parameter here}} | ||
void img2d_rw(read_write image2d_t); // expected-note 2{{passing argument to parameter here}} | ||
void img2d_default(image2d_t); // expected-note 2{{passing argument to parameter here}} | ||
|
||
void imgage_access_test(image2d_t img2dro, write_only image2d_t img2dwo, image3d_t img3dro) { | ||
img2d_ro(img2dro); | ||
img2d_ro(img2dwo); // expected-error{{passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}} | ||
void imgage_access_test(image2d_t img2dro, image3d_t img3dro) { | ||
img2d_ro(img2dro); // read_only = read_only | ||
img2d_ro(img3dro); // expected-error{{passing '__read_only image3d_t' to parameter of incompatible type '__read_only image2d_t'}} | ||
} | ||
|
||
kernel void read_only_access_test(read_only image2d_t img) { | ||
img2d_ro(img); // read_only = read_only | ||
img2d_wo(img); // expected-error {{passing '__read_only image2d_t' to parameter of incompatible type '__write_only image2d_t'}} | ||
img2d_rw(img); // expected-error {{passing '__read_only image2d_t' to parameter of incompatible type '__read_write image2d_t'}} | ||
img2d_default(img); // read_only = read_only | ||
} | ||
|
||
kernel void write_only_access_test(write_only image2d_t img) { | ||
img2d_ro(img); // expected-error {{passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}} | ||
img2d_wo(img); // write_only = write_only | ||
img2d_rw(img); // expected-error {{passing '__write_only image2d_t' to parameter of incompatible type '__read_write image2d_t'}} | ||
img2d_default(img); // expected-error {{passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}} | ||
} | ||
|
||
kernel void read_write_access_test(read_write image2d_t img) { | ||
img2d_ro(img); // expected-error {{passing '__read_write image2d_t' to parameter of incompatible type '__read_only image2d_t'}} | ||
img2d_wo(img); // expected-error {{passing '__read_write image2d_t' to parameter of incompatible type '__write_only image2d_t'}} | ||
img2d_rw(img); //read_write = read_write | ||
img2d_default(img); // expected-error {{passing '__read_write image2d_t' to parameter of incompatible type '__read_only image2d_t'}} | ||
} |