[PATCH] D17438: [OpenCL] Add Sema checks for atomics and implicit declaration

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 19 12:01:16 PST 2016


Anastasia added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:3900
@@ -3899,1 +3899,3 @@
   if (!DeclaresAnything) {
+    // OpenCL C doesn't support bit-field, so declaration with no declarator
+    // has no use.
----------------
I am still not convinced about this change? Could you give reference to spec or an example? I don't understand why you are trying to change default C behavior.

================
Comment at: lib/Sema/SemaDecl.cpp:7283
@@ -7276,3 +7282,3 @@
       return PtrPtrKernelParam;
-    return PointeeType.getAddressSpace() == 0 ? PrivatePtrKernelParam
-                                              : PtrKernelParam;
+    // Now generice address space is added, we need to handle like this
+    unsigned addrSpace = PointeeType.getAddressSpace();
----------------
Why this code?

================
Comment at: test/Parser/opencl-atomics-cl20.cl:71
@@ +70,3 @@
+void atomic_init_test() {
+    atomic_int guide = ATOMIC_VAR_INIT(42); // expected-error {{initialization of atomic variables is restricted to variables in global address space in opencl}}
+}
----------------
Please remove the macro here as it doesn't have any functionality.

This message seems wrong. Why is it restricted to variables in global address space?

We have similar diagnostic err_atomic_init_constant. Could you reuse it, may be with help of %select?


http://reviews.llvm.org/D17438





More information about the cfe-commits mailing list