[RISCV] Simplify usage of SplatPat_simm5_plus1. NFC (#125340)
[llvm-project.git] / clang / test / Analysis / void-call-exit-modelling.c
blob6fc8cb54f00bcdc0ddccc232e3082026347e2ae7
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -analyzer-output text -verify %s
3 typedef __typeof(sizeof(int)) size_t;
4 void *malloc(size_t size);
6 void inf_loop_break_callee() {
7 void* data = malloc(10); // expected-note{{Memory is allocated}}
8 while (1) { // expected-note{{Loop condition is true}}
9 (void)data;
10 break; // No note that we jump to the line above from this break
11 } // expected-note@-1{{Execution jumps to the end of the function}}
12 } // expected-warning{{Potential leak of memory pointed to by 'data'}}
13 // expected-note@-1 {{Potential leak of memory pointed to by 'data'}}
15 void inf_loop_break_caller() {
16 inf_loop_break_callee(); // expected-note{{Calling 'inf_loop_break_callee'}}
19 void inf_loop_break_top() {
20 void* data = malloc(10); // expected-note{{Memory is allocated}}
21 while (1) { // expected-note{{Loop condition is true}}
22 (void)data;
23 break; // No note that we jump to the line above from this break
24 } // expected-note@-1{{Execution jumps to the end of the function}}
25 } // expected-warning{{Potential leak of memory pointed to by 'data'}}
26 // expected-note@-1 {{Potential leak of memory pointed to by 'data'}}