[PATCH] D30643: [OpenCL] Extended diagnostics for atomic initialization

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 08:24:02 PDT 2017


Anastasia added inline comments.


================
Comment at: test/SemaOpenCL/atomic-init.cl:6
+kernel void test_atomic_initialization() {
+  a1 = 1; // expected-error {{atomic variable can only be assigned to a compile time constant and to variables in global adress space}}
+  atomic_int a2 = 0; // expected-error {{atomic variable can only be assigned to a compile time constant and to variables in global adress space}}
----------------
Btw, you could keep "initialized" here by using 'select' in the diagnostic message. 


================
Comment at: test/SemaOpenCL/atomic-init.cl:10
+  local atomic_int a4 = 0; // expected-error {{'__local' variable cannot have an initializer}}
+  global atomic_int a5 = 0; // expected-error {{function scope variable cannot be declared in global address space}}
+}
----------------
Could we also add a check for 'static global' variable?


https://reviews.llvm.org/D30643





More information about the cfe-commits mailing list