diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-21 10:50:08 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-21 10:50:08 +0000 |
| commit | c0c7bca4e5b8d12699dc93a0da49e9e4bb79671b (patch) | |
| tree | 508d4388db78f87d35bf26a0400b4b03bc4c1f13 /test/Sema | |
| parent | 4a37f65f1c1373c9956d118a012943de2f61edb0 (diff) | |
Notes
Diffstat (limited to 'test/Sema')
| -rw-r--r-- | test/Sema/block-byref-args.c | 22 | ||||
| -rw-r--r-- | test/Sema/block-misc.c | 2 | ||||
| -rw-r--r-- | test/Sema/invalid-init-diag.c | 2 | ||||
| -rw-r--r-- | test/Sema/warn-shadow.c | 45 | ||||
| -rw-r--r-- | test/Sema/x86-intrinsics-headers.c | 8 |
5 files changed, 56 insertions, 23 deletions
diff --git a/test/Sema/block-byref-args.c b/test/Sema/block-byref-args.c deleted file mode 100644 index 255c97b280c9..000000000000 --- a/test/Sema/block-byref-args.c +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks - -int printf(const char *, ...); - -int main(int argc, char **argv) { - __block void(*bobTheFunction)(void); - __block void(^bobTheBlock)(void); - - bobTheBlock = ^{;}; - - __block int JJJJ; - __attribute__((__blocks__(byref))) int III; - - int (^XXX)(void) = ^{ return III+JJJJ; }; - - // rdar 7671883 - __block char array[10] = {'a', 'b', 'c', 'd'}; - char (^ch)() = ^{ array[1] = 'X'; return array[5]; }; - ch(); - - return 0; -} diff --git a/test/Sema/block-misc.c b/test/Sema/block-misc.c index 1109be6311b0..ca71ab12b268 100644 --- a/test/Sema/block-misc.c +++ b/test/Sema/block-misc.c @@ -214,8 +214,10 @@ void test20() { // radr://7438948 void test21() { int a[7]; // expected-note {{declared at}} + __block int b[10]; // expected-note {{declared at}} a[1] = 1; ^{ (void)a[1]; // expected-error {{cannot refer to declaration with an array type inside block}} + (void)b[1]; // expected-error {{cannot refer to declaration with an array type inside block}} }(); } diff --git a/test/Sema/invalid-init-diag.c b/test/Sema/invalid-init-diag.c index a215fa7c254b..dec7d6c18f8a 100644 --- a/test/Sema/invalid-init-diag.c +++ b/test/Sema/invalid-init-diag.c @@ -1,4 +1,4 @@ // RUN: %clang_cc1 %s -verify -fsyntax-only int a; -struct {int x;} x = a; // expected-error {{incompatible type initializing 'int', expected 'struct <anonymous>'}} +struct {int x;} x = a; // expected-error {{incompatible type initializing 'int', expected 'struct <anonymous}} diff --git a/test/Sema/warn-shadow.c b/test/Sema/warn-shadow.c new file mode 100644 index 000000000000..c9a783b437a0 --- /dev/null +++ b/test/Sema/warn-shadow.c @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -fblocks -Wshadow %s + +int i; // expected-note 3 {{previous declaration is here}} + +void foo() { + int pass1; + int i; // expected-warning {{declaration shadows a variable in the global scope}} \ + // expected-note {{previous declaration is here}} + { + int pass2; + int i; // expected-warning {{declaration shadows a local variable}} \ + // expected-note {{previous declaration is here}} + { + int pass3; + int i; // expected-warning {{declaration shadows a local variable}} + } + } + + int sin; // okay; 'sin' has not been declared, even though it's a builtin. +} + +// <rdar://problem/7677531> +void (^test1)(int) = ^(int i) { // expected-warning {{declaration shadows a variable in the global scope}} \ + // expected-note{{previous declaration is here}} + { + int i; // expected-warning {{declaration shadows a local variable}} \ + // expected-note{{previous declaration is here}} + + (^(int i) { return i; })(i); //expected-warning {{declaration shadows a local variable}} + } +}; + + +struct test2 { + int i; +}; + +void test3(void) { + struct test4 { + int i; + }; +} + +void test4(int i) { // expected-warning {{declaration shadows a variable in the global scope}} +} diff --git a/test/Sema/x86-intrinsics-headers.c b/test/Sema/x86-intrinsics-headers.c index 006716ef5ba4..24c2d925e00d 100644 --- a/test/Sema/x86-intrinsics-headers.c +++ b/test/Sema/x86-intrinsics-headers.c @@ -21,4 +21,12 @@ #include <tmmintrin.h> # endif +# if defined(__SSE4_1__) +#include <smmintrin.h> +# endif + +# if defined(__SSE4_2__) +#include <nmmintrin.h> +# endif + #endif |
