diff options
Diffstat (limited to 'test/SemaCUDA')
-rw-r--r-- | test/SemaCUDA/config-type.cu | 3 | ||||
-rw-r--r-- | test/SemaCUDA/cuda.h | 19 | ||||
-rw-r--r-- | test/SemaCUDA/kernel-call.cu | 15 | ||||
-rw-r--r-- | test/SemaCUDA/qualifiers.cu | 8 |
4 files changed, 45 insertions, 0 deletions
diff --git a/test/SemaCUDA/config-type.cu b/test/SemaCUDA/config-type.cu new file mode 100644 index 0000000..a469d38 --- /dev/null +++ b/test/SemaCUDA/config-type.cu @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void cudaConfigureCall(unsigned gridSize, unsigned blockSize); // expected-error {{must have scalar return type}} diff --git a/test/SemaCUDA/cuda.h b/test/SemaCUDA/cuda.h new file mode 100644 index 0000000..e3aeb99 --- /dev/null +++ b/test/SemaCUDA/cuda.h @@ -0,0 +1,19 @@ +/* Minimal declarations for CUDA support. Testing purposes only. */ + +#include <stddef.h> + +#define __constant__ __attribute__((constant)) +#define __device__ __attribute__((device)) +#define __global__ __attribute__((global)) +#define __host__ __attribute__((host)) +#define __shared__ __attribute__((shared)) + +struct dim3 { + unsigned x, y, z; + dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {} +}; + +typedef struct cudaStream *cudaStream_t; + +int cudaConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0, + cudaStream_t stream = 0); diff --git a/test/SemaCUDA/kernel-call.cu b/test/SemaCUDA/kernel-call.cu new file mode 100644 index 0000000..6d51695 --- /dev/null +++ b/test/SemaCUDA/kernel-call.cu @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#include "cuda.h" + +__global__ void g1(int x) {} + +template <typename T> void t1(T arg) { + g1<<<arg, arg>>>(1); +} + +int main(void) { + g1<<<1, 1>>>(42); + + t1(1); +} diff --git a/test/SemaCUDA/qualifiers.cu b/test/SemaCUDA/qualifiers.cu new file mode 100644 index 0000000..1346d65 --- /dev/null +++ b/test/SemaCUDA/qualifiers.cu @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#include "cuda.h" + +__global__ void g1(int x) {} +__global__ int g2(int x) { // expected-error {{must have void return type}} + return 1; +} |