aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/ftime-trace-removeDead.cpp
blob: 2ffd2ec45908c422b6167e09b105d996379fb91e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s -ftime-trace=%t.raw.json -ftime-trace-granularity=0 -verify
// RUN: %python -c 'import json, sys; print(json.dumps(json.load(sys.stdin), indent=4))' < %t.raw.json > %t.formatted.json
// RUN: FileCheck --input-file=%t.formatted.json --check-prefix=CHECK %s

// The trace file is rather large, but it should contain at least one scope for removeDead:
//
// CHECK:          "name": "ExprEngine::removeDead"

bool coin();
int f() {
    int x = 0;
    int y = 0;
    while (coin()) {
        x = 1;
    }
    return x / y; // expected-warning{{Division by zero}}
}