1 // RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=debug.DumpCFG -std=c++14 -analyzer-config eagerly-assume=false %s > %t 2>&1
2 // RUN: FileCheck --input-file=%t %s
3 // RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=core,debug.ExprInspection -std=c++14 -verify -analyzer-config eagerly-assume=false %s
5 void clang_analyzer_eval(bool);
20 // CHECK: void foo(int)
22 // CHECK-NEXT: 1: (CXXConstructExpr, [B1.2], B)
23 // CHECK-NEXT: 2: B i;
24 // CHECK-NEXT: 3: operator=
25 // CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, FunctionToPointerDecay, B &(*)(B &&) noexcept)
27 // CHECK-NEXT: 6: {} (CXXConstructExpr, [B1.7], [B1.8], B)
28 // CHECK-NEXT: 7: [B1.6] (BindTemporary)
29 // CHECK-NEXT: 8: [B1.7]
30 // CHECK-NEXT: 9: [B1.5] = [B1.8] (OperatorCall)
31 // CHECK-NEXT: 10: ~B() (Temporary object destructor)
32 // CHECK-NEXT: 11: [B1.2].~B() (Implicit destructor)
41 clang_analyzer_eval(global
== 2); // expected-warning{{TRUE}}
44 } // end namespace variant_0
57 // CHECK: template<> void foo<int>(int)
59 // CHECK-NEXT: 1: (CXXConstructExpr, [B1.2], B)
60 // CHECK-NEXT: 2: B i;
61 // CHECK-NEXT: 3: operator=
62 // CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, FunctionToPointerDecay, B &(*)(B &&) noexcept)
64 // CHECK-NEXT: 6: {} (CXXConstructExpr, [B1.7], [B1.8], B)
65 // CHECK-NEXT: 7: [B1.6] (BindTemporary)
66 // CHECK-NEXT: 8: [B1.7]
67 // CHECK-NEXT: 9: [B1.5] = [B1.8] (OperatorCall)
68 // CHECK-NEXT: 10: ~B() (Temporary object destructor)
69 // CHECK-NEXT: 11: [B1.2].~B() (Implicit destructor)
70 template <typename T
> void foo(T
) {
78 clang_analyzer_eval(global
== 2); // expected-warning{{TRUE [debug.ExprInspection]}}
81 } // end namespace variant_1
84 // Making field 'a' in class 'B' public turns the class into an aggregate.
85 // In this case there is no constructor at {} - only an aggregate
86 // initialization. Aggregate initialization is unsupported for now.
98 // CHECK: template<> void foo<int>(int)
100 // CHECK-NEXT: 1: (CXXConstructExpr, [B1.2], B)
101 // CHECK-NEXT: 2: B i;
102 // CHECK-NEXT: 3: operator=
103 // CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, FunctionToPointerDecay, B &(*)(B &&) noexcept)
107 // CHECK-NEXT: 8: [B1.7] (BindTemporary)
108 // CHECK-NEXT: 9: [B1.8]
109 // CHECK-NEXT: 10: [B1.5] = [B1.9] (OperatorCall)
110 // CHECK-NEXT: 11: ~B() (Temporary object destructor)
111 // CHECK-NEXT: 12: [B1.2].~B() (Implicit destructor)
112 template <typename T
> void foo(T
) {
120 // FIXME: Should be TRUE, i.e. we should call (and inline) two destructors.
121 clang_analyzer_eval(global
== 2); // expected-warning{{UNKNOWN}}
124 } // end namespace variant_2