1 // RUN: %clang_analyze_cc1 -fblocks -analyzer-checker core,unix -verify %s
3 typedef __typeof(sizeof(int)) size_t;
4 void *calloc(size_t, size_t);
6 typedef struct dispatch_queue_s
*dispatch_queue_t
;
7 typedef void (^dispatch_block_t
)(void);
8 void dispatch_sync(dispatch_queue_t
, dispatch_block_t
);
10 void test_no_state_change_in_body_farm(dispatch_queue_t queue
) {
11 dispatch_sync(queue
, ^{}); // no-crash
13 } // expected-warning{{Potential memory leak}}
15 void test_no_state_change_in_body_farm_2(dispatch_queue_t queue
) {
16 void *p
= calloc(1, 1);
17 dispatch_sync(queue
, ^{}); // no-crash
19 } // expected-warning{{Potential leak of memory pointed to by 'p'}}