diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
commit | 77212133072dc40f070a280af8217032f55a9eb4 (patch) | |
tree | 2fd5819f49caecc5f520219b6b9254fe94ebb138 /test/Parser | |
parent | 4b08eb6308ca90a6c08e2fc79d100821b1b1f6aa (diff) | |
download | FreeBSD-src-77212133072dc40f070a280af8217032f55a9eb4.zip FreeBSD-src-77212133072dc40f070a280af8217032f55a9eb4.tar.gz |
Update clang to 91430.
Diffstat (limited to 'test/Parser')
29 files changed, 107 insertions, 29 deletions
diff --git a/test/Parser/check-objc2-syntax-1.m b/test/Parser/check-objc2-syntax-1.m index f596e9b..aafb2e0 100644 --- a/test/Parser/check-objc2-syntax-1.m +++ b/test/Parser/check-objc2-syntax-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Subclass + (int)magicNumber; diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m index af1b7a8..8ad2072 100644 --- a/test/Parser/check-syntax-1.m +++ b/test/Parser/check-syntax-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}} @end diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp index 3fa2842..6f3fd39 100644 --- a/test/Parser/cxx-decl.cpp +++ b/test/Parser/cxx-decl.cpp @@ -1,3 +1,54 @@ // RUN: clang-cc -verify -fsyntax-only %s int x(*g); // expected-error {{use of undeclared identifier 'g'}} + +struct Type { + int Type; +}; + + +// PR4451 - We should recover well from the typo of '::' as ':' in a2. +namespace y { + struct a { }; + typedef int b; +} + +y::a a1; +y:a a2; // expected-error {{unexpected ':' in nested name specifier}} +y::a a3 = a2; + +// Some valid colons: +void foo() { +y: // label + y::a s; + + int a = 4; + a = a ? a : a+1; +} + +struct b : y::a {}; + +template <typename T> +class someclass { + + int bar() { + T *P; + return 1 ? P->x : P->y; + } +}; + +enum { fooenum = 1 }; + +struct a { + int Type : fooenum; +}; + +void test(struct Type *P) { + int Type; + Type = 1 ? P->Type : Type; + + Type = (y:b) 4; // expected-error {{unexpected ':' in nested name specifier}} + Type = 1 ? ( + (y:b) // expected-error {{unexpected ':' in nested name specifier}} + 4) : 5; +}
\ No newline at end of file diff --git a/test/Parser/cxx-extern-c-array.cpp b/test/Parser/cxx-extern-c-array.cpp new file mode 100644 index 0000000..1a04fa0 --- /dev/null +++ b/test/Parser/cxx-extern-c-array.cpp @@ -0,0 +1,7 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +extern "C" int myarray[]; +int myarray[12] = {0}; + +extern "C" int anotherarray[][3]; +int anotherarray[2][3] = {1,2,3,4,5,6}; diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp index 14b31af..6505ad0 100644 --- a/test/Parser/cxx-friend.cpp +++ b/test/Parser/cxx-friend.cpp @@ -30,3 +30,11 @@ class B { void f(A *a) { a->f(); } }; + + + + +template <typename t1, typename t2> class some_template; +friend // expected-error {{'friend' used outside of class}} +some_template<foo, bar>& // expected-error {{use of undeclared identifier 'foo'}} + ; // expected-error {{expected unqualified-id}} diff --git a/test/Parser/cxx-try.cpp b/test/Parser/cxx-stmt.cpp index 535f40d..cc35ba1 100644 --- a/test/Parser/cxx-try.cpp +++ b/test/Parser/cxx-stmt.cpp @@ -1,6 +1,6 @@ // RUN: clang-cc -fsyntax-only -verify %s -void f() +void f1() { try { ; @@ -10,7 +10,7 @@ void f() } } -void g() +void f2() { try; // expected-error {{expected '{'}} @@ -24,7 +24,7 @@ void g() catch {} // expected-error {{expected '('}} } -void h() try { +void f3() try { } catch(...) { } @@ -39,3 +39,16 @@ struct A { A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}} A::A(int j) try : i(j) {} catch(...) {} + + + +// PR5740 +struct Type { }; + +enum { Type } Kind; +void f4() { + int i = 0; + switch (Kind) { + case Type: i = 7; break; // no error. + } +}
\ No newline at end of file diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp index 461b9e5..20c9fb3 100644 --- a/test/Parser/cxx-using-declaration.cpp +++ b/test/Parser/cxx-using-declaration.cpp @@ -1,5 +1,4 @@ // RUN: clang-cc -fsyntax-only -verify %s -// XFAIL: * namespace A { int VA; diff --git a/test/Parser/encode.m b/test/Parser/encode.m index 1e088a0..15e9fe9 100644 --- a/test/Parser/encode.m +++ b/test/Parser/encode.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s int main(void) { const char ch = @encode(char *)[2]; diff --git a/test/Parser/enhanced-proto-1.m b/test/Parser/enhanced-proto-1.m index 1f42ec2..b80eb7d0 100644 --- a/test/Parser/enhanced-proto-1.m +++ b/test/Parser/enhanced-proto-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol MyProto1 @optional diff --git a/test/Parser/expressions.m b/test/Parser/expressions.m index e9e4121..9adc34a 100644 --- a/test/Parser/expressions.m +++ b/test/Parser/expressions.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -parse-noop %s +// RUN: clang -cc1 -parse-noop %s void test1() { @"s"; // expected-warning {{expression result unused}} diff --git a/test/Parser/method-prototype-1.m b/test/Parser/method-prototype-1.m index 1d535de..86a912f 100644 --- a/test/Parser/method-prototype-1.m +++ b/test/Parser/method-prototype-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -parse-noop +// RUN: clang -cc1 %s -parse-noop @interface MyObject - (void) bycopy : (int) woodo, ... ; - (void) break : (int) woodo, ... ; diff --git a/test/Parser/objc-alias-printing.m b/test/Parser/objc-alias-printing.m index e121bed..afb522c 100644 --- a/test/Parser/objc-alias-printing.m +++ b/test/Parser/objc-alias-printing.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -ast-print %s +// RUN: clang -cc1 -ast-print %s @protocol P1 @end @protocol P2 @end diff --git a/test/Parser/objc-category-neg-1.m b/test/Parser/objc-category-neg-1.m index 6c1bd29..957dbde 100644 --- a/test/Parser/objc-category-neg-1.m +++ b/test/Parser/objc-category-neg-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s void __assert_rtn(const char *, const char *, int, const char *) __attribute__((__noreturn__)); static __inline__ int __inline_isfinitef (float ) __attribute__ ((always_inline)); diff --git a/test/Parser/objc-forcollection-1.m b/test/Parser/objc-forcollection-1.m index 21ec308..6075332 100644 --- a/test/Parser/objc-forcollection-1.m +++ b/test/Parser/objc-forcollection-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: clang -cc1 -fsyntax-only %s typedef struct objc_class *Class; typedef struct objc_object { diff --git a/test/Parser/objc-forcollection-neg-2.m b/test/Parser/objc-forcollection-neg-2.m index ddb279b..9019d44 100644 --- a/test/Parser/objc-forcollection-neg-2.m +++ b/test/Parser/objc-forcollection-neg-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_class *Class; typedef struct objc_object { diff --git a/test/Parser/objc-forcollection-neg.m b/test/Parser/objc-forcollection-neg.m index 0f2bb90..464759e 100644 --- a/test/Parser/objc-forcollection-neg.m +++ b/test/Parser/objc-forcollection-neg.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_class *Class; typedef struct objc_object { diff --git a/test/Parser/objc-foreach-syntax.m b/test/Parser/objc-foreach-syntax.m index 977dccc..294a602 100644 --- a/test/Parser/objc-foreach-syntax.m +++ b/test/Parser/objc-foreach-syntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s diff --git a/test/Parser/objc-init.m b/test/Parser/objc-init.m index bc88e33..b3f033e 100644 --- a/test/Parser/objc-init.m +++ b/test/Parser/objc-init.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -pedantic +// RUN: clang -cc1 -fsyntax-only -verify %s -pedantic // rdar://5707001 @interface NSNumber; diff --git a/test/Parser/objc-interfaces.m b/test/Parser/objc-interfaces.m index 7aa6729..fdb52e7 100644 --- a/test/Parser/objc-interfaces.m +++ b/test/Parser/objc-interfaces.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify // Test features and error recovery for objc interfaces. diff --git a/test/Parser/objc-messaging-1.m b/test/Parser/objc-messaging-1.m index 4a36fc9..2ee3639 100644 --- a/test/Parser/objc-messaging-1.m +++ b/test/Parser/objc-messaging-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -parse-noop +// RUN: clang -cc1 %s -parse-noop int main () { int i,j; diff --git a/test/Parser/objc-messaging-neg-1.m b/test/Parser/objc-messaging-neg-1.m index 0344566..4dcbb79 100644 --- a/test/Parser/objc-messaging-neg-1.m +++ b/test/Parser/objc-messaging-neg-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s int main() { id a; diff --git a/test/Parser/objc-missing-impl.m b/test/Parser/objc-missing-impl.m index 9108451..392b26f 100644 --- a/test/Parser/objc-missing-impl.m +++ b/test/Parser/objc-missing-impl.m @@ -1,2 +1,2 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @end // expected-warning {{@end must appear in an @implementation context}} diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m index cf75aaa..294fb54 100644 --- a/test/Parser/objc-property-syntax.m +++ b/test/Parser/objc-property-syntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MyClass { diff --git a/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m index 2913b58..233739b 100644 --- a/test/Parser/objc-quirks.m +++ b/test/Parser/objc-quirks.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // FIXME: This is a horrible error message here. Fix. int @"s" = 5; // expected-error {{prefix attribute must be}} diff --git a/test/Parser/objc-synthesized-recover.m b/test/Parser/objc-synthesized-recover.m index 7de1a57..dbe9b1d 100644 --- a/test/Parser/objc-synthesized-recover.m +++ b/test/Parser/objc-synthesized-recover.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface I1 { diff --git a/test/Parser/objc-try-catch-1.m b/test/Parser/objc-try-catch-1.m index 98c6d16..25b5279 100644 --- a/test/Parser/objc-try-catch-1.m +++ b/test/Parser/objc-try-catch-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -fsyntax-only -verify %s -// RUN: clang-cc -fsyntax-only -verify -x objective-c++ %s +// RUN: clang -cc1 -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify -x objective-c++ %s void * proc(); @interface NSConstantString diff --git a/test/Parser/objc-type-printing.m b/test/Parser/objc-type-printing.m index d9ad704..e619b72 100644 --- a/test/Parser/objc-type-printing.m +++ b/test/Parser/objc-type-printing.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -ast-print %s +// RUN: clang -cc1 -ast-print %s @protocol P1 @end @protocol P2 @end diff --git a/test/Parser/prefix-attributes.m b/test/Parser/prefix-attributes.m index bb6d04d..31be340 100644 --- a/test/Parser/prefix-attributes.m +++ b/test/Parser/prefix-attributes.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -fsyntax-only %s +// RUN: clang -cc1 -verify -fsyntax-only %s __attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface or protocol}} diff --git a/test/Parser/selector-1.m b/test/Parser/selector-1.m index 85ef919..fdc74ff 100644 --- a/test/Parser/selector-1.m +++ b/test/Parser/selector-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -parse-noop %s +// RUN: clang -cc1 -parse-noop %s int main() { SEL s = @selector(retain); |