Ted Kremenek | 43ae4b0 | 2008-04-24 18:28:14 +0000 | [diff] [blame] | 1 | // RUN: clang -checker-simple -verify %s |
| 2 | |
| 3 | struct FPRec { |
| 4 | void (*my_func)(int * x); |
| 5 | }; |
| 6 | |
| 7 | int bar(int x); |
| 8 | |
| 9 | int f1_a(struct FPRec* foo) { |
| 10 | int x; |
| 11 | (*foo->my_func)(&x); |
| 12 | return bar(x)+1; // no-warning |
| 13 | } |
| 14 | |
| 15 | int f1_b() { |
| 16 | int x; |
| 17 | return bar(x)+1; // expected-warning{{Pass-by-value argument in function is undefined.}} |
| 18 | } |
Ted Kremenek | 5c454ab | 2008-05-05 15:56:53 +0000 | [diff] [blame] | 19 | |
| 20 | int f2() { |
| 21 | |
| 22 | int x; |
| 23 | |
| 24 | if (x+1) // expected-warning{{Branch}} |
| 25 | return 1; |
| 26 | |
| 27 | return 2; |
| 28 | } |
| 29 | |
| 30 | int f2_b() { |
| 31 | int x; |
| 32 | |
| 33 | return ((x+1)+2+((x))) + 1 ? 1 : 2; // expected-warning{{Branch}} |
| 34 | } |
| 35 | |