2011-03-15 13:22:33 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fblocks %s -verify
|
2011-01-27 10:01:31 +08:00
|
|
|
|
|
|
|
// Duplicated from uninit-variables.c.
|
|
|
|
// Test just to ensure the analysis is working.
|
|
|
|
int test1() {
|
2011-09-10 13:35:08 +08:00
|
|
|
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
2011-04-08 14:33:38 +08:00
|
|
|
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
|
2011-01-27 10:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Test ObjC fast enumeration.
|
|
|
|
void test2() {
|
|
|
|
id collection = 0;
|
|
|
|
for (id obj in collection) {
|
|
|
|
if (0 == obj) // no-warning
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void test3() {
|
|
|
|
id collection = 0;
|
|
|
|
id obj;
|
|
|
|
for (obj in collection) { // no-warning
|
|
|
|
if (0 == obj) // no-warning
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|