blob: f3917f3922d58cdd58a1485b805b8baff2440a73 [file] [log] [blame]
Ted Kremenek1ea800c2011-01-27 02:01:31 +00001// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fblocks %s -verify
2
3// Duplicated from uninit-variables.c.
4// Test just to ensure the analysis is working.
5int test1() {
6 int x; // expected-warning{{use of uninitialized variable 'x'}} expected-note{{add initialization to silence this warning}}
7 return x; // expected-note{{variable 'x' is possibly uninitialized when used here}}
8}
9
10// Test ObjC fast enumeration.
11void test2() {
12 id collection = 0;
13 for (id obj in collection) {
14 if (0 == obj) // no-warning
15 break;
16 }
17}
18
19void test3() {
20 id collection = 0;
21 id obj;
22 for (obj in collection) { // no-warning
23 if (0 == obj) // no-warning
24 break;
25 }
26}
27