| 1 |
// RUN: %clang_analyze_cc1 -verify %s 2>&1 \ |
| 2 |
// RUN: -analyzer-display-progress \ |
| 3 |
// RUN: -analyzer-checker=debug.ExprInspection \ |
| 4 |
// RUN: -analyzer-output=text \ |
| 5 |
// RUN: | FileCheck %s |
| 6 |
|
| 7 |
void clang_analyzer_warnIfReached(); |
| 8 |
|
| 9 |
// expected-note@+2 {{[debug] analyzing from f()}} |
| 10 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 11 |
void f() { clang_analyzer_warnIfReached(); } |
| 12 |
|
| 13 |
// expected-note@+2 {{[debug] analyzing from g()}} |
| 14 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 15 |
void g() { clang_analyzer_warnIfReached(); } |
| 16 |
|
| 17 |
// expected-note@+2 {{[debug] analyzing from h()}} |
| 18 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 19 |
void h() { clang_analyzer_warnIfReached(); } |
| 20 |
|
| 21 |
struct SomeStruct { |
| 22 |
// expected-note@+2 {{[debug] analyzing from SomeStruct::f()}} |
| 23 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 24 |
void f() { clang_analyzer_warnIfReached(); } |
| 25 |
}; |
| 26 |
|
| 27 |
struct SomeOtherStruct { |
| 28 |
// expected-note@+2 {{[debug] analyzing from SomeOtherStruct::f()}} |
| 29 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 30 |
void f() { clang_analyzer_warnIfReached(); } |
| 31 |
}; |
| 32 |
|
| 33 |
namespace ns { |
| 34 |
struct SomeStruct { |
| 35 |
// expected-note@+2 {{[debug] analyzing from ns::SomeStruct::f(int)}} |
| 36 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 37 |
void f(int) { clang_analyzer_warnIfReached(); } |
| 38 |
// expected-note@+2 {{[debug] analyzing from ns::SomeStruct::f(float, ::SomeStruct)}} |
| 39 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 40 |
void f(float, ::SomeStruct) { clang_analyzer_warnIfReached(); } |
| 41 |
// expected-note@+2 {{[debug] analyzing from ns::SomeStruct::f(float, SomeStruct)}} |
| 42 |
// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}} |
| 43 |
void f(float, SomeStruct) { clang_analyzer_warnIfReached(); } |
| 44 |
}; |
| 45 |
} |
| 46 |
|
| 47 |
// CHECK: analyzer-display-progress.cpp f() : {{[0-9]+}} |
| 48 |
// CHECK: analyzer-display-progress.cpp g() : {{[0-9]+}} |
| 49 |
// CHECK: analyzer-display-progress.cpp h() : {{[0-9]+}} |
| 50 |
// CHECK: analyzer-display-progress.cpp SomeStruct::f() : {{[0-9]+}} |
| 51 |
// CHECK: analyzer-display-progress.cpp SomeOtherStruct::f() : {{[0-9]+}} |
| 52 |
// CHECK: analyzer-display-progress.cpp ns::SomeStruct::f(int) : {{[0-9]+}} |
| 53 |
// CHECK: analyzer-display-progress.cpp ns::SomeStruct::f(float, ::SomeStruct) : {{[0-9]+}} |
| 54 |
// CHECK: analyzer-display-progress.cpp ns::SomeStruct::f(float, SomeStruct) : {{[0-9]+}} |