[PATCH] D103191: [OpenCL] Add support of __opencl_c_program_scope_global_variables feature macro
Sven van Haastregt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 27 01:46:26 PDT 2021
svenvh added inline comments.
================
Comment at: clang/test/SemaOpenCL/storageclass.cl:22
+extern generic float g_generic_extern_var;
+#ifndef __opencl_c_program_scope_global_variables
+// expected-error at -17 {{program scope variable must reside in constant address space}}
----------------
Not sure if this is the best way to restructure this test? Now the diagnostics are quite far away from the declarations, and it is harder to see which diagnostic belongs to which declaration.
I wonder if the following would be a better structure instead:
```
int G3 = 0;
#ifndef __opencl_c_program_scope_global_variables
// expected-error at -2 {{program scope variable must reside in constant address space}}
#endif
global int G4 = 0;
#ifndef __opencl_c_program_scope_global_variables
// expected-error at -2 {{program scope variable must reside in constant address space}}
#endif
... etc. ...
```
The downside is that it is a bit more verbose due to the repetition of the `#if` guards, but it makes the test more readable/maintainable in my opinion.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103191/new/
https://reviews.llvm.org/D103191
More information about the cfe-commits
mailing list