Clang Project

clang_source_code/test/Analysis/temp-obj-dtors-option.cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-temp-dtor-inlining=false -verify -analyzer-config eagerly-assume=false %s
2// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-temp-dtor-inlining=true -DINLINE -verify -analyzer-config eagerly-assume=false %s
3
4void clang_analyzer_eval(bool);
5
6struct S {
7  int &x;
8
9  S(int &x) : x(x) { ++x; }
10  ~S() { --x; }
11};
12
13void foo() {
14  int x = 0;
15  S(x).x += 1;
16  clang_analyzer_eval(x == 1);
17#ifdef INLINE
18  // expected-warning@-2{{TRUE}}
19#else
20  // expected-warning@-4{{UNKNOWN}}
21#endif
22}
23