1 | // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify %s 2>&1 | FileCheck %s |
2 | |
3 | // Self-tests for the debug.ExprInspection checker. |
4 | |
5 | void clang_analyzer_dump(int x); |
6 | void clang_analyzer_printState(); |
7 | void clang_analyzer_numTimesReached(); |
8 | |
9 | void foo(int x) { |
10 | clang_analyzer_dump(x); // expected-warning{{reg_$0<int x>}} |
11 | clang_analyzer_dump(x + (-1)); // expected-warning{{(reg_$0<int x>) + -1}} |
12 | int y = 1; |
13 | clang_analyzer_printState(); |
14 | for (; y < 3; ++y) |
15 | clang_analyzer_numTimesReached(); // expected-warning{{2}} |
16 | } |
17 | |
18 | // CHECK: Store (direct and default bindings) |
19 | // CHECK-NEXT: (y,0,direct) : 1 S32b |
20 | |
21 | // CHECK: Expressions by stack frame: |
22 | // CHECK-NEXT: #0 Calling foo |
23 | // CHECK-NEXT: clang_analyzer_printState : &code{clang_analyzer_printState} |
24 | |
25 | // CHECK: {{(Ranges are empty.)|(Constraints:[[:space:]]*$)}} |
26 | |