55 lines · cpp
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 %s6 7void clang_analyzer_warnIfReached();8 9// expected-note@+2 {{[debug] analyzing from f()}}10// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}}11void f() { clang_analyzer_warnIfReached(); }12 13// expected-note@+2 {{[debug] analyzing from g()}}14// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}}15void g() { clang_analyzer_warnIfReached(); }16 17// expected-note@+2 {{[debug] analyzing from h()}}18// expected-warning@+1 {{REACHABLE}} expected-note@+1 {{REACHABLE}}19void h() { clang_analyzer_warnIfReached(); }20 21struct 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 27struct 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 33namespace 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]+}}55