diff options
| author | Sven van Haastregt <sven.vanhaastregt@arm.com> | 2018-09-20 10:07:27 +0000 |
|---|---|---|
| committer | Sven van Haastregt <sven.vanhaastregt@arm.com> | 2018-09-20 10:07:27 +0000 |
| commit | 1076cc2ffae3333db3faaa00751456479ea28ac6 (patch) | |
| tree | d14f83258cc11a5eb1e314b0bf587c5d1405d273 /clang/test/SemaOpenCL | |
| parent | 1724c3481d8237ecb5ef23bf8da04af670d425ff (diff) | |
| download | bcm5719-llvm-1076cc2ffae3333db3faaa00751456479ea28ac6.tar.gz bcm5719-llvm-1076cc2ffae3333db3faaa00751456479ea28ac6.zip | |
[OpenCL] Diagnose redundant address space conversion
Add a warning if a parameter with a named address space is passed
to a to_addr builtin.
For example:
int i;
to_private(&i); // generate warning as conversion from private to private is redundant.
Patch by Alistair Davies.
Differential Revision: https://reviews.llvm.org/D51411
llvm-svn: 342638
Diffstat (limited to 'clang/test/SemaOpenCL')
| -rw-r--r-- | clang/test/SemaOpenCL/to_addr_builtin.cl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/test/SemaOpenCL/to_addr_builtin.cl b/clang/test/SemaOpenCL/to_addr_builtin.cl index 70956f007a5..9b95ff4e64b 100644 --- a/clang/test/SemaOpenCL/to_addr_builtin.cl +++ b/clang/test/SemaOpenCL/to_addr_builtin.cl @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -verify -fsyntax-only %s -// RUN: %clang_cc1 -verify -fsyntax-only -cl-std=CL2.0 %s +// RUN: %clang_cc1 -Wconversion -verify -fsyntax-only -cl-std=CL2.0 %s void test(void) { global int *glob; @@ -43,6 +43,7 @@ void test(void) { // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *' from 'int'}} #else // expected-error@-4{{assigning '__global int *' to '__local int *' changes address space of pointer}} + // expected-warning@-5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance}} #endif global char *glob_c = to_global(loc); @@ -50,6 +51,7 @@ void test(void) { // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *' with an expression of type 'int'}} #else // expected-warning@-4{{incompatible pointer types initializing '__global char *' with an expression of type '__global int *'}} + // expected-warning@-5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance}} #endif } |

