diff options
Diffstat (limited to 'test/Parser')
-rw-r--r-- | test/Parser/altivec.c | 91 | ||||
-rw-r--r-- | test/Parser/cxx-altivec.cpp | 108 | ||||
-rw-r--r-- | test/Parser/cxx-decl.cpp | 6 | ||||
-rw-r--r-- | test/Parser/cxx-template-decl.cpp | 10 | ||||
-rw-r--r-- | test/Parser/declarators.c | 23 | ||||
-rw-r--r-- | test/Parser/objc-property-syntax.m | 2 | ||||
-rw-r--r-- | test/Parser/statements.c | 2 |
7 files changed, 239 insertions, 3 deletions
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c new file mode 100644 index 0000000..99544ea --- /dev/null +++ b/test/Parser/altivec.c @@ -0,0 +1,91 @@ +// RUN: %clang_cc1 -faltivec -fsyntax-only -verify %s + +__vector char vv_c; +__vector signed char vv_sc; +__vector unsigned char vv_uc; +__vector short vv_s; +__vector signed short vv_ss; +__vector unsigned short vv_us; +__vector short int vv_si; +__vector signed short int vv_ssi; +__vector unsigned short int vv_usi; +__vector int vv_i; +__vector signed int vv_sint; +__vector unsigned int vv_ui; +__vector float vv_f; +__vector bool vv_b; +__vector __pixel vv_p; +__vector pixel vv__p; +__vector int vf__r(); +void vf__a(__vector int a); +void vf__a2(int b, __vector int a); + +vector char v_c; +vector signed char v_sc; +vector unsigned char v_uc; +vector short v_s; +vector signed short v_ss; +vector unsigned short v_us; +vector short int v_si; +vector signed short int v_ssi; +vector unsigned short int v_usi; +vector int v_i; +vector signed int v_sint; +vector unsigned int v_ui; +vector float v_f; +vector bool v_b; +vector __pixel v_p; +vector pixel v__p; +vector int f__r(); +void f_a(vector int a); +void f_a2(int b, vector int a); + +// These should have warnings. +__vector long vv_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector signed long vv_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector unsigned long vv_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector long int vv_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector signed long int vv_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector unsigned long int vv_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector long v_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector signed long v_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector unsigned long v_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector long int v_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector signed long int v_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector unsigned long int v_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector long double vv_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +vector long double v_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} + +// These should have errors. +__vector double vv_d; // expected-error {{cannot use "double" with "__vector"}} +__vector double vv_d; // expected-error {{cannot use "double" with "__vector"}} +vector double v_d; // expected-error {{cannot use "double" with "__vector"}} +vector double v_d; // expected-error {{cannot use "double" with "__vector"}} +__vector long double vv_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +vector long double v_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} + +void f() { + __vector unsigned int v = {0,0,0,0}; + __vector int v__cast = (__vector int)v; + __vector int v_cast = (vector int)v; + __vector char vb_cast = (vector char)v; + + // Check some casting between gcc and altivec vectors. + #define gccvector __attribute__((vector_size(16))) + gccvector unsigned int gccv = {0,0,0,0}; + gccvector unsigned int gccv1 = gccv; + gccvector int gccv2 = (gccvector int)gccv; + gccvector unsigned int gccv3 = v; + __vector unsigned int av = gccv; + __vector int avi = (__vector int)gccv; + gccvector unsigned int gv = v; + gccvector int gvi = (gccvector int)v; + __attribute__((vector_size(8))) unsigned int gv8; + gv8 = gccv; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int', expected '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} + av = gv8; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int', expected '__vector unsigned int'}} + + v = gccv; + __vector unsigned int tv = gccv; + gccv = v; + gccvector unsigned int tgv = v; +} diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp new file mode 100644 index 0000000..a26eee4 --- /dev/null +++ b/test/Parser/cxx-altivec.cpp @@ -0,0 +1,108 @@ +// RUN: %clang_cc1 -faltivec -fsyntax-only -verify %s + +// This is the same as the C version: + +__vector char vv_c; +__vector signed char vv_sc; +__vector unsigned char vv_uc; +__vector short vv_s; +__vector signed short vv_ss; +__vector unsigned short vv_us; +__vector short int vv_si; +__vector signed short int vv_ssi; +__vector unsigned short int vv_usi; +__vector int vv_i; +__vector signed int vv_sint; +__vector unsigned int vv_ui; +__vector float vv_f; +__vector bool vv_b; +__vector __pixel vv_p; +__vector pixel vv__p; +__vector int vf__r(); +void vf__a(__vector int a); +void vf__a2(int b, __vector int a); + +vector char v_c; +vector signed char v_sc; +vector unsigned char v_uc; +vector short v_s; +vector signed short v_ss; +vector unsigned short v_us; +vector short int v_si; +vector signed short int v_ssi; +vector unsigned short int v_usi; +vector int v_i; +vector signed int v_sint; +vector unsigned int v_ui; +vector float v_f; +vector bool v_b; +vector __pixel v_p; +vector pixel v__p; +vector int f__r(); +void f_a(vector int a); +void f_a2(int b, vector int a); + +// These should have warnings. +__vector long vv_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector signed long vv_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector unsigned long vv_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector long int vv_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector signed long int vv_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector unsigned long int vv_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector long v_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector signed long v_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector unsigned long v_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector long int v_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector signed long int v_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +vector unsigned long int v_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} +__vector long double vv_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +vector long double v_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} + +// These should have errors. +__vector double vv_d1; // expected-error {{cannot use "double" with "__vector"}} +vector double v_d2; // expected-error {{cannot use "double" with "__vector"}} +__vector long double vv_ld3; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +vector long double v_ld4; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} + +void f() { + __vector unsigned int v = {0,0,0,0}; + __vector int v__cast = (__vector int)v; + __vector int v_cast = (vector int)v; + __vector char vb_cast = (vector char)v; + + // Check some casting between gcc and altivec vectors. + #define gccvector __attribute__((vector_size(16))) + gccvector unsigned int gccv = {0,0,0,0}; + gccvector unsigned int gccv1 = gccv; + gccvector int gccv2 = (gccvector int)gccv; + gccvector unsigned int gccv3 = v; + __vector unsigned int av = gccv; + __vector int avi = (__vector int)gccv; + gccvector unsigned int gv = v; + gccvector int gvi = (gccvector int)v; + __attribute__((vector_size(8))) unsigned int gv8; + gv8 = gccv; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int', expected '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} + av = gv8; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int', expected '__vector unsigned int'}} + + v = gccv; + __vector unsigned int tv = gccv; + gccv = v; + gccvector unsigned int tgv = v; +} + +// Now for the C++ version: + +class vc__v { + __vector int v; + __vector int f__r(); + void f__a(__vector int a); + void f__a2(int b, __vector int a); +}; + +class c_v { + vector int v; + vector int f__r(); + void f__a(vector int a); + void f__a2(int b, vector int a); +}; + diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp index 3c88b7a..f37604c 100644 --- a/test/Parser/cxx-decl.cpp +++ b/test/Parser/cxx-decl.cpp @@ -52,3 +52,9 @@ void test(struct Type *P) { (y:b) // expected-error {{unexpected ':' in nested name specifier}} 4) : 5; } + +struct test4 { + int x // expected-error {{expected ';' at end of declaration list}} + int y; + int z // expected-error {{expected ';' at end of declaration list}} +}; diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp index 5cb84a6..3f8f1ec 100644 --- a/test/Parser/cxx-template-decl.cpp +++ b/test/Parser/cxx-template-decl.cpp @@ -96,3 +96,13 @@ void f2() { // PR3844 template <> struct S<int> { }; // expected-error{{explicit specialization of non-template struct 'S'}} + +namespace PR6184 { + namespace N { + template <typename T> + void bar(typename T::x); + } + + template <typename T> + void N::bar(typename T::x) { } +} diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c index 3831199..91803c1 100644 --- a/test/Parser/declarators.c +++ b/test/Parser/declarators.c @@ -47,8 +47,8 @@ int test6() { return a; } // a should be declared. // Use of tagged type without tag. rdar://6783347 struct xyz { int y; }; enum myenum { ASDFAS }; -xyz b; // expected-error {{use of tagged type 'xyz' without 'struct' tag}} -myenum c; // expected-error {{use of tagged type 'myenum' without 'enum' tag}} +xyz b; // expected-error {{must use 'struct' tag to refer to type 'xyz'}} +myenum c; // expected-error {{must use 'enum' tag to refer to type 'myenum'}} float *test7() { // We should recover 'b' by parsing it with a valid type of "struct xyz", which @@ -64,3 +64,22 @@ static f; // expected-warning {{type specifier missing, defaults to 'int'}} static g = 4; // expected-warning {{type specifier missing, defaults to 'int'}} static h // expected-warning {{type specifier missing, defaults to 'int'}} __asm__("foo"); + + +struct test9 { + int x // expected-error {{expected ';' at end of declaration list}} + int y; + int z // expected-warning {{expected ';' at end of declaration list}} +}; + +// PR6208 +struct test10 { int a; } static test10x; +struct test11 { int a; } const test11x; + +// PR6216 +void test12() { + (void)__builtin_offsetof(struct { char c; int i; }, i); +} + +// rdar://7608537 +struct test13 { int a; } (test13x); diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m index b5f57f3..064a209 100644 --- a/test/Parser/objc-property-syntax.m +++ b/test/Parser/objc-property-syntax.m @@ -5,8 +5,10 @@ }; @property unsigned char bufferedUTF8Bytes[4]; // expected-error {{property cannot have array or function type}} @property unsigned char bufferedUTFBytes:1; // expected-error {{property name cannot be a bitfield}} +@property(nonatomic, retain, setter=ab_setDefaultToolbarItems) MyClass *ab_defaultToolbarItems; // expected-error {{method name referenced in property setter attribute must end with ':'}} @end @implementation MyClass +@dynamic ab_defaultToolbarItems; @end diff --git a/test/Parser/statements.c b/test/Parser/statements.c index 8fec0f1..a662c9b 100644 --- a/test/Parser/statements.c +++ b/test/Parser/statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code void test1() { { ; { ;;}} ;; |