| 1 |
// RUN: %clang_cc1 -triple x86_64-apple-macos11 -fsyntax-only -fobjc-arc -fblocks -verify -Wunused-but-set-variable -Wno-objc-root-class %s |
| 2 |
|
| 3 |
id getFoo(void); |
| 4 |
|
| 5 |
void test() { |
| 6 |
// no diagnostics for objects with precise lifetime semantics. |
| 7 |
__attribute__((objc_precise_lifetime)) id x; |
| 8 |
x = getFoo(); |
| 9 |
|
| 10 |
id x2; // expected-warning {{variable 'x2' set but not used}} |
| 11 |
x2 = getFoo(); |
| 12 |
|
| 13 |
do { |
| 14 |
__attribute__((objc_precise_lifetime)) id y; |
| 15 |
y = getFoo(); |
| 16 |
|
| 17 |
id y2; // expected-warning {{variable 'y2' set but not used}} |
| 18 |
y2 = getFoo(); |
| 19 |
} while(0); |
| 20 |
|
| 21 |
x = ((void *)0); |
| 22 |
} |