[PATCH] D101843: [OpenCL] Add clang extension for bitfields

Sven van Haastregt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 6 08:41:29 PDT 2021


svenvh added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:1748
+With this extension it is possible to enable bitfields in structs
+or unions using regular OpenCL extension pragma mechanism detailed in
+`the OpenCL Extension Specification, section 1.2
----------------



================
Comment at: clang/lib/Sema/SemaDecl.cpp:16798
     }
     // OpenCL v1.2 s6.9.c: bitfields are not supported.
+    if (BitWidth && !getOpenCLOptions().isAvailableOption(
----------------



================
Comment at: clang/test/SemaOpenCL/unsupported.cl:11
+#ifndef BITFIELDS_EXT
+// expected-error at -2 {{bit-fields are not supported in OpenCL}}
+#endif
----------------
The extension has "bitfields" in the name but most diagnostics (including this one) spell it as "bit-fields".  I wonder what the least surprising name would be?  It seems Clang tends to use the hyphenated form in diagnostics and the non-hyphenated form in e.g. option names (e.g. `fsigned-bitfields`), so using the non-hyphenated form in the extension name is probably fine.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101843/new/

https://reviews.llvm.org/D101843



More information about the cfe-commits mailing list