[PATCH] D13105: [OpenCL] Enable program scope variables for OpenCL2.0

Pekka Jääskeläinen via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 10:12:08 PDT 2015


pekka.jaaskelainen requested changes to this revision.
pekka.jaaskelainen added a comment.
This revision now requires changes to proceed.

Could only find style nitpicks in this one.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7473
@@ -7470,3 +7472,3 @@
 def err_opencl_global_invalid_addr_space : Error<
-  "global variables must have a constant address space qualifier">;
+  "program scope variables has wrong address space qualifier">;
 def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
----------------
variable

================
Comment at: lib/Sema/SemaDecl.cpp:6443
@@ +6442,3 @@
+  // address space.
+  if (getLangOpts().OpenCL){
+    if (NewVD->isFileVarDecl()){
----------------
There are white space issues in this patch block.

================
Comment at: lib/Sema/SemaDecl.cpp:6469
@@ +6468,3 @@
+        DeclContext *EnclDC = NewVD->getDeclContext();
+        while (!isa<FunctionDecl>(EnclDC))
+          EnclDC = EnclDC->getParent();
----------------
Is there really no simpler way to find the FunctionDecl?

================
Comment at: lib/Sema/SemaDecl.cpp:6472
@@ +6471,3 @@
+        FunctionDecl *FD = dyn_cast<FunctionDecl>(EnclDC);
+        if (FD && (FD->hasAttr<OpenCLKernelAttr>() == false)) {
+          if (T.getAddressSpace() == LangAS::opencl_constant)
----------------
Is there a reason not to use the ! operator instead of comparing to false?


http://reviews.llvm.org/D13105





More information about the cfe-commits mailing list