mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 15:46:08 +00:00

Restrict the following keywords in the OpenCL C++ language mode, according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification. - dynamic_cast - typeid - register (already restricted in OpenCL C, update the diagnostic) - thread_local - exceptions (try/catch/throw) - access qualifiers read_only, write_only, read_write Support the `__global`, `__local`, `__constant`, `__private`, and `__generic` keywords in OpenCL C++. Leave the unprefixed address space qualifiers such as global available, i.e., do not mark them as reserved keywords in OpenCL C++. libclcxx provides explicit address space pointer classes such as `global_ptr` and `global<T>` that are implemented using the `__`-prefixed qualifiers. Differential Revision: https://reviews.llvm.org/D46022 llvm-svn: 331874
16 lines
861 B
Common Lisp
16 lines
861 B
Common Lisp
// RUN: %clang_cc1 %s -verify -fsyntax-only -triple spir-unknown-unknown
|
|
|
|
void test_storage_class_specs()
|
|
{
|
|
static int a; // expected-error {{OpenCL C version 1.0 does not support the 'static' storage class specifier}}
|
|
register int b; // expected-error {{OpenCL C version 1.0 does not support the 'register' storage class specifier}}
|
|
extern int c; // expected-error {{OpenCL C version 1.0 does not support the 'extern' storage class specifier}}
|
|
auto int d; // expected-error {{OpenCL C version 1.0 does not support the 'auto' storage class specifier}}
|
|
|
|
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
|
|
static int e; // expected-error {{static local variable must reside in constant address space}}
|
|
register int f;
|
|
extern int g; // expected-error {{extern variable must reside in constant address space}}
|
|
auto int h;
|
|
}
|