| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify %s |
| 2 |
|
| 3 |
using size_t = __typeof(sizeof(int)); |
| 4 |
|
| 5 |
void clang_analyzer_explain(int); |
| 6 |
void clang_analyzer_dump(int); |
| 7 |
void *memset(void *, int, size_t); |
| 8 |
|
| 9 |
struct S |
| 10 |
{ |
| 11 |
static int a; |
| 12 |
~S(){}; |
| 13 |
}; |
| 14 |
|
| 15 |
int S::a = 0; |
| 16 |
|
| 17 |
void foo() |
| 18 |
{ |
| 19 |
S::a = 0; |
| 20 |
|
| 21 |
int x = 3; |
| 22 |
memset(&x, 1, sizeof(x)); |
| 23 |
|
| 24 |
S *arr = new S[x]; |
| 25 |
delete[] arr; |
| 26 |
|
| 27 |
clang_analyzer_dump(S::a); // expected-warning-re{{{{derived_\$[0-9]+{conj_\$[0-9]+{int, LC[0-9]+, S[0-9]+, #[0-9]+},a}}}}} |
| 28 |
|
| 29 |
clang_analyzer_explain(S::a); // expected-warning-re{{{{value derived from \(symbol of type 'int' conjured at CFG element '->~S\(\) \(Implicit destructor\)'\) for global variable 'S::a'}}}} |
| 30 |
} |