1 | // RUN: %clang_analyze_cc1 %s -analyzer-checker=core,osx.cocoa.RetainCount -fblocks -verify |
2 | |
3 | // This test is checking behavior when a single checker runs only with the core |
4 | // checkers, testing that the traversal order in the CFG does not affect the |
5 | // reporting of an error. |
6 | |
7 | #import "Inputs/system-header-simulator-objc.h" |
8 | |
9 | void testDoubleRelease(BOOL z) { |
10 | id x = [[NSObject alloc] init]; |
11 | if (z) { |
12 | [x release]; |
13 | } else { |
14 | ; |
15 | } |
16 | [x release]; // expected-warning {{Reference-counted object is used after it is released}} |
17 | } |
18 | |
19 | void testDoubleRelease2(BOOL z) { |
20 | id x = [[NSObject alloc] init]; |
21 | if (z) { |
22 | ; |
23 | } else { |
24 | [x release]; |
25 | } |
26 | [x release]; // expected-warning {{Reference-counted object is used after it is released}} |
27 | } |
28 | |