[PATCH] D23712: [OpenCL] Override supported OpenCL extensions with -cl-ext option

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 08:31:47 PDT 2016


yaxunl added a comment.

I think we need two more tests for concatenating and overriding the option, e.g

  -cl-ext=-cl_khr_fp64 -cl-ext=+cl_khr_fp64

and

  -cl-ext=-cl_khr_fp64,+cl_khr_fp64


================
Comment at: include/clang/Basic/OpenCLOptions.h:35
@@ +34,3 @@
+  void setAll(bool Enable = true) {
+#define OPENCLEXT(nm)   nm = Enable ? 1 : 0;
+#include "clang/Basic/OpenCLExtensions.def"
----------------
  nm = Enable;

================
Comment at: include/clang/Basic/OpenCLOptions.h:39
@@ +38,3 @@
+
+  void set(llvm::StringRef Ext, bool Enable = true) {
+    assert(!Ext.empty() && "Extension is empty.");
----------------
It seems Enable should be a local variable.

================
Comment at: include/clang/Basic/OpenCLOptions.h:59
@@ +58,3 @@
+    if (Ext.equals(#nm)) {  \
+      nm = Enable ? 1 : 0;  \
+    }
----------------
  nm = Enable;

================
Comment at: include/clang/Driver/Options.td:395
@@ -394,1 +394,3 @@
+def cl_ext_EQ : CommaJoined<["-"], "cl-ext=">, Group<opencl_Group>, Flags<[CC1Option]>,
+  HelpText<"OpenCL only. Enable or disable specific OpenCL extensions.">;
 def client__name : JoinedOrSeparate<["-"], "client_name">;
----------------
maybe something like 

  ... Enable or disable specific OpenCL extensions separated by comma. Use 'all' for all extensions.


https://reviews.llvm.org/D23712





More information about the cfe-commits mailing list