Re: r314650 - Dependent Address Space Support Test File

2017-10-02 Thread Andrew Gozillon via cfe-commits
Thank you very much for the help. I have committed a change that should fix 
this, I tested it with my normal build and the triple you referenced and it 
works in both cases. I shall continue to keep an eye on the build bot.


Best Regards,

Andrew Gozillon


From: NAKAMURA Takumi <geek4ci...@gmail.com>
Sent: 02 October 2017 11:09:51
To: Andrew Gozillon; cfe-commits@lists.llvm.org
Subject: Re: r314650 - Dependent Address Space Support Test File

On Mon, Oct 2, 2017 at 3:33 PM Andrew Gozillon via cfe-commits 
<cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>> wrote:
Author: agozillon
Date: Sun Oct  1 23:31:25 2017
New Revision: 314650

URL: http://llvm.org/viewvc/llvm-project?rev=314650=rev
Log:
Dependent Address Space Support Test File

Adding regression test for Dependent Address Spaces in relation to
https://reviews.llvm.org/D33666 I forgot to svn add the test file
before commiting the prior changes. I appologies.


Added:
cfe/trunk/test/SemaTemplate/address_space-dependent.cpp

Added: cfe/trunk/test/SemaTemplate/address_space-dependent.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/address_space-dependent.cpp?rev=314650=auto
==
--- cfe/trunk/test/SemaTemplate/address_space-dependent.cpp (added)
+++ cfe/trunk/test/SemaTemplate/address_space-dependent.cpp Sun Oct  1 23:31:25 
2017
@@ -0,0 +1,119 @@
+// RUN: %clang_cc1 -x c++ -std=c++14 -fsyntax-only -verify %s
+
+template 
+void car() {
+  int __attribute__((address_space(I))) __attribute__((address_space(J))) * Y; 
 // expected-error {{multiple address spaces specified for type}}
+  int *__attribute__((address_space(I))) __attribute__((address_space(J))) * 
Z; // expected-error {{multiple address spaces specified for type}}
+
+  __attribute__((address_space(I))) int local;// expected-error 
{{automatic variable qualified with an address space}}
+  __attribute__((address_space(J))) int array[5]; // expected-error 
{{automatic variable qualified with an address space}}
+  __attribute__((address_space(I))) int arrarr[5][5]; // expected-error 
{{automatic variable qualified with an address space}}
+
+  __attribute__((address_space(J))) * x; // expected-error {{C++ requires a 
type specifier for all declarations}}
+
+  __attribute__((address_space(I))) float *B;
+
+  typedef __attribute__((address_space(J))) int AS2Int;
+  struct HasASFields {
+AS2Int typedef_as_field; // expected-error {{field may not be qualified 
with an address space}}
+  };
+
+  struct _st {
+int x, y;
+  } s __attribute((address_space(I))) = {1, 1};
+}
+
+template 
+struct HasASTemplateFields {
+  __attribute__((address_space(I))) int as_field; // expected-error {{field 
may not be qualified with an address space}}
+};
+
+template 
+void foo(__attribute__((address_space(I))) float *a, // expected-note 
{{candidate template ignored: substitution failure [with I = 1, J = 2]: 
parameter may not be qualified with an address space}}
+ __attribute__((address_space(J))) float b) {
+  *a = 5.0f + b;
+}
+
+template void foo<1, 2>(float *, float); // expected-error {{explicit 
instantiation of 'foo' does not refer to a function template, variable 
template, member function, member class, or static data member}}
+
+template 
+void neg() {
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address 
space is negative}}
+}
+
+template 
+void toBig() {
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address 
space is larger than the maximum supported (8388599)}}
+}
+
+template 
+void correct() {
+  __attribute__((address_space(I))) int *bounds;
+}
+
+template 
+char *cmp(__attribute__((address_space(I))) char *x, 
__attribute__((address_space(J))) char *y) {
+  return x < y ? x : y; // expected-error {{comparison of distinct pointer 
types ('__attribute__((address_space(1))) char *' and 
'__attribute__((address_space(2))) char *')}}
+}
+
+typedef void ft(void);
+
+template 
+struct fooFunction {
+  __attribute__((address_space(I))) void **const base = 0;
+
+  void *get_0(void) {
+return base[0]; // expected-error {{cannot initialize return object of 
type 'void *' with an lvalue of type '__attribute__((address_space(1))) void *}}
+  }
+
+  __attribute__((address_space(I))) ft qf; // expected-error {{function type 
may not be qualified with an address space}}
+  __attribute__((address_space(I))) char *test3_val;
+
+  void test3(void) {
+extern void test3_helper(char *p); // expected-note {{passing argument to 
parameter 'p' here}}
+test3_helper(test3_val);   // expected-error {{cannot initialize a 
parameter of type 'char *' with an lvalue of type 
'__attribute__((address_space(1))) char *'}}
+  }
+};
+
+template 
+int GetAddressSpaceValue(T __attribute__((address_space(N))) * p) {
+  return N;
+}
+
+template  int __attribute__((addres

Re: r314650 - Dependent Address Space Support Test File

2017-10-02 Thread NAKAMURA Takumi via cfe-commits
On Mon, Oct 2, 2017 at 3:33 PM Andrew Gozillon via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: agozillon
> Date: Sun Oct  1 23:31:25 2017
> New Revision: 314650
>
> URL: http://llvm.org/viewvc/llvm-project?rev=314650=rev
> Log:
> Dependent Address Space Support Test File
>
> Adding regression test for Dependent Address Spaces in relation to
> https://reviews.llvm.org/D33666 I forgot to svn add the test file
> before commiting the prior changes. I appologies.
>
>
> Added:
> cfe/trunk/test/SemaTemplate/address_space-dependent.cpp
>
> Added: cfe/trunk/test/SemaTemplate/address_space-dependent.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/address_space-dependent.cpp?rev=314650=auto
>
> ==
> --- cfe/trunk/test/SemaTemplate/address_space-dependent.cpp (added)
> +++ cfe/trunk/test/SemaTemplate/address_space-dependent.cpp Sun Oct  1
> 23:31:25 2017
> @@ -0,0 +1,119 @@
> +// RUN: %clang_cc1 -x c++ -std=c++14 -fsyntax-only -verify %s
> +
> +template 
> +void car() {
> +  int __attribute__((address_space(I))) __attribute__((address_space(J)))
> * Y;  // expected-error {{multiple address spaces specified for type}}
> +  int *__attribute__((address_space(I)))
> __attribute__((address_space(J))) * Z; // expected-error {{multiple address
> spaces specified for type}}
> +
> +  __attribute__((address_space(I))) int local;// expected-error
> {{automatic variable qualified with an address space}}
> +  __attribute__((address_space(J))) int array[5]; // expected-error
> {{automatic variable qualified with an address space}}
> +  __attribute__((address_space(I))) int arrarr[5][5]; // expected-error
> {{automatic variable qualified with an address space}}
> +
> +  __attribute__((address_space(J))) * x; // expected-error {{C++ requires
> a type specifier for all declarations}}
> +
> +  __attribute__((address_space(I))) float *B;
> +
> +  typedef __attribute__((address_space(J))) int AS2Int;
> +  struct HasASFields {
> +AS2Int typedef_as_field; // expected-error {{field may not be
> qualified with an address space}}
> +  };
> +
> +  struct _st {
> +int x, y;
> +  } s __attribute((address_space(I))) = {1, 1};
> +}
> +
> +template 
> +struct HasASTemplateFields {
> +  __attribute__((address_space(I))) int as_field; // expected-error
> {{field may not be qualified with an address space}}
> +};
> +
> +template 
> +void foo(__attribute__((address_space(I))) float *a, // expected-note
> {{candidate template ignored: substitution failure [with I = 1, J = 2]:
> parameter may not be qualified with an address space}}
> + __attribute__((address_space(J))) float b) {
> +  *a = 5.0f + b;
> +}
> +
> +template void foo<1, 2>(float *, float); // expected-error {{explicit
> instantiation of 'foo' does not refer to a function template, variable
> template, member function, member class, or static data member}}
> +
> +template 
> +void neg() {
> +  __attribute__((address_space(I))) int *bounds; // expected-error
> {{address space is negative}}
> +}
> +
> +template 
> +void toBig() {
> +  __attribute__((address_space(I))) int *bounds; // expected-error
> {{address space is larger than the maximum supported (8388599)}}
> +}
> +
> +template 
> +void correct() {
> +  __attribute__((address_space(I))) int *bounds;
> +}
> +
> +template 
> +char *cmp(__attribute__((address_space(I))) char *x,
> __attribute__((address_space(J))) char *y) {
> +  return x < y ? x : y; // expected-error {{comparison of distinct
> pointer types ('__attribute__((address_space(1))) char *' and
> '__attribute__((address_space(2))) char *')}}
> +}
> +
> +typedef void ft(void);
> +
> +template 
> +struct fooFunction {
> +  __attribute__((address_space(I))) void **const base = 0;
> +
> +  void *get_0(void) {
> +return base[0]; // expected-error {{cannot initialize return object
> of type 'void *' with an lvalue of type '__attribute__((address_space(1)))
> void *}}
> +  }
> +
> +  __attribute__((address_space(I))) ft qf; // expected-error {{function
> type may not be qualified with an address space}}
> +  __attribute__((address_space(I))) char *test3_val;
> +
> +  void test3(void) {
> +extern void test3_helper(char *p); // expected-note {{passing
> argument to parameter 'p' here}}
> +test3_helper(test3_val);   // expected-error {{cannot
> initialize a parameter of type 'char *' with an lvalue of type
> '__attribute__((address_space(1))) char *'}}
> +  }
> +};
> +
> +template 
> +int GetAddressSpaceValue(T __attribute__((address_space(N))) * p) {
> +  return N;
> +}
> +
> +template  int __attribute__((address_space(A)))
> *same_template();
> +template  int __attribute__((address_space(B)))
> *same_template();
> +void test_same_template() { (void) same_template<0>(); }
> +
> +template  int __attribute__((address_space(A)))
> *different_template(); // expected-note {{candidate function [with A = 0]}}
> +template  

r314650 - Dependent Address Space Support Test File

2017-10-02 Thread Andrew Gozillon via cfe-commits
Author: agozillon
Date: Sun Oct  1 23:31:25 2017
New Revision: 314650

URL: http://llvm.org/viewvc/llvm-project?rev=314650=rev
Log:
Dependent Address Space Support Test File

Adding regression test for Dependent Address Spaces in relation to
https://reviews.llvm.org/D33666 I forgot to svn add the test file 
before commiting the prior changes. I appologies. 


Added:
cfe/trunk/test/SemaTemplate/address_space-dependent.cpp

Added: cfe/trunk/test/SemaTemplate/address_space-dependent.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/address_space-dependent.cpp?rev=314650=auto
==
--- cfe/trunk/test/SemaTemplate/address_space-dependent.cpp (added)
+++ cfe/trunk/test/SemaTemplate/address_space-dependent.cpp Sun Oct  1 23:31:25 
2017
@@ -0,0 +1,119 @@
+// RUN: %clang_cc1 -x c++ -std=c++14 -fsyntax-only -verify %s
+
+template 
+void car() {
+  int __attribute__((address_space(I))) __attribute__((address_space(J))) * Y; 
 // expected-error {{multiple address spaces specified for type}}
+  int *__attribute__((address_space(I))) __attribute__((address_space(J))) * 
Z; // expected-error {{multiple address spaces specified for type}}
+
+  __attribute__((address_space(I))) int local;// expected-error 
{{automatic variable qualified with an address space}}
+  __attribute__((address_space(J))) int array[5]; // expected-error 
{{automatic variable qualified with an address space}}
+  __attribute__((address_space(I))) int arrarr[5][5]; // expected-error 
{{automatic variable qualified with an address space}}
+
+  __attribute__((address_space(J))) * x; // expected-error {{C++ requires a 
type specifier for all declarations}}
+
+  __attribute__((address_space(I))) float *B;
+
+  typedef __attribute__((address_space(J))) int AS2Int;
+  struct HasASFields {
+AS2Int typedef_as_field; // expected-error {{field may not be qualified 
with an address space}}
+  };
+
+  struct _st {
+int x, y;
+  } s __attribute((address_space(I))) = {1, 1};
+}
+
+template 
+struct HasASTemplateFields {
+  __attribute__((address_space(I))) int as_field; // expected-error {{field 
may not be qualified with an address space}}
+};
+
+template 
+void foo(__attribute__((address_space(I))) float *a, // expected-note 
{{candidate template ignored: substitution failure [with I = 1, J = 2]: 
parameter may not be qualified with an address space}}
+ __attribute__((address_space(J))) float b) {
+  *a = 5.0f + b;
+}
+
+template void foo<1, 2>(float *, float); // expected-error {{explicit 
instantiation of 'foo' does not refer to a function template, variable 
template, member function, member class, or static data member}}
+
+template 
+void neg() {
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address 
space is negative}}
+}
+
+template 
+void toBig() {
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address 
space is larger than the maximum supported (8388599)}}
+}
+
+template 
+void correct() {
+  __attribute__((address_space(I))) int *bounds;
+}
+
+template 
+char *cmp(__attribute__((address_space(I))) char *x, 
__attribute__((address_space(J))) char *y) {
+  return x < y ? x : y; // expected-error {{comparison of distinct pointer 
types ('__attribute__((address_space(1))) char *' and 
'__attribute__((address_space(2))) char *')}}
+}
+
+typedef void ft(void);
+
+template 
+struct fooFunction {
+  __attribute__((address_space(I))) void **const base = 0;
+
+  void *get_0(void) {
+return base[0]; // expected-error {{cannot initialize return object of 
type 'void *' with an lvalue of type '__attribute__((address_space(1))) void *}}
+  }
+
+  __attribute__((address_space(I))) ft qf; // expected-error {{function type 
may not be qualified with an address space}}
+  __attribute__((address_space(I))) char *test3_val;
+
+  void test3(void) {
+extern void test3_helper(char *p); // expected-note {{passing argument to 
parameter 'p' here}}
+test3_helper(test3_val);   // expected-error {{cannot initialize a 
parameter of type 'char *' with an lvalue of type 
'__attribute__((address_space(1))) char *'}}
+  }
+};
+
+template 
+int GetAddressSpaceValue(T __attribute__((address_space(N))) * p) {
+  return N;
+}
+
+template  int __attribute__((address_space(A))) *same_template();
+template  int __attribute__((address_space(B))) *same_template();
+void test_same_template() { (void) same_template<0>(); }
+
+template  int __attribute__((address_space(A))) 
*different_template(); // expected-note {{candidate function [with A = 0]}}
+template  int __attribute__((address_space(B+1))) 
*different_template(); // expected-note {{candidate function [with B = 0]}}
+void test_different_template() { (void) different_template<0>(); } // 
expected-error {{call to 'different_template' is ambiguous}}
+
+template  struct partial_spec_deduce_as;
+template  
+struct partial_spec_deduce_as