summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2018-06-22 16:20:21 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2018-06-22 16:20:21 +0000
commit7f785bb458b5dd7575f44b77779f797a4923cd58 (patch)
tree5d9045af16fa80f21505b622cc3daaa01d1b97cc
parent43de6db2f4d2d2134db29e5696616f99cdb33c40 (diff)
downloadbcm5719-llvm-7f785bb458b5dd7575f44b77779f797a4923cd58.tar.gz
bcm5719-llvm-7f785bb458b5dd7575f44b77779f797a4923cd58.zip
[OpenCL] Fixed parsing of address spaces for C++.
Added address space tokens to C++ parsing code to be able to parse declarations that start from an address space keyword. llvm-svn: 335362
-rw-r--r--clang/lib/Parse/ParseTentative.cpp5
-rw-r--r--clang/test/SemaOpenCL/address-spaces.cl4
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index dbc8d550ad3..79860545c29 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -1357,6 +1357,11 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult,
// cv-qualifier
case tok::kw_const:
case tok::kw_volatile:
+ case tok::kw___private:
+ case tok::kw___local:
+ case tok::kw___global:
+ case tok::kw___constant:
+ case tok::kw___generic:
// GNU
case tok::kw_restrict:
diff --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl
index c5c58a6a30d..3ac2569bc28 100644
--- a/clang/test/SemaOpenCL/address-spaces.cl
+++ b/clang/test/SemaOpenCL/address-spaces.cl
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -cl-std=c++ -verify -pedantic -fsyntax-only
__constant int ci = 1;
@@ -8,6 +9,8 @@ __kernel void foo(__global int *gip) {
__local int lj = 2; // expected-error {{'__local' variable cannot have an initializer}}
int *ip;
+// FIXME: Temporarily disable part of the test that doesn't work for C++ yet.
+#if !__OPENCL_CPP_VERSION__
#if __OPENCL_C_VERSION__ < 200
ip = gip; // expected-error {{assigning '__global int *' to 'int *' changes address space of pointer}}
ip = &li; // expected-error {{assigning '__local int *' to 'int *' changes address space of pointer}}
@@ -64,4 +67,5 @@ void func_multiple_addr(void) {
__local private_int_t *var4; // expected-error {{multiple address spaces specified for type}}
__private private_int_t var5; // expected-warning {{multiple identical address spaces specified for type}}
__private private_int_t *var6;// expected-warning {{multiple identical address spaces specified for type}}
+#endif // !__OPENCL_CXX_VERSION__
}
OpenPOWER on IntegriCloud