[PATCH] D17345: [OpenCL] Improve diagnostics of address spaces for variables inside function

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 17 13:11:34 PST 2016


yaxunl added inline comments.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7653
@@ -7654,1 +7652,3 @@
+def err_opencl_function_variable : Error<
+  "%select{non-kernel function|non-program scope}0 variable cannot be declared in %1 address space">;
 def err_static_function_scope : Error<
----------------
is it better to use 'function scope' instead of 'non-program scope' ?

================
Comment at: test/SemaOpenCL/storageclass-cl20.cl:1
@@ -1,2 +1,2 @@
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -DCL20 -cl-std=CL2.0
 
----------------
remove -DCL20

================
Comment at: test/SemaOpenCL/storageclass-cl20.cl:23
@@ -19,1 +22,3 @@
+  extern global int G5;
+  extern int G6; // expected-error{{program scope variable must reside in global or constant address space}}
 }
----------------
'extern int G6' refers to a program-scope variable 'int G6', since the default addr space of program-scope var is global, shouldn't 'extern int G6' have global addr space by default instead of private addr space?


http://reviews.llvm.org/D17345





More information about the cfe-commits mailing list