blob: 0e1ec2f9de56684c153e55c583a01de7b9131c5e [file] [log] [blame]
Nithin Vadukkumchery Rajendrakumar37c1bf22020-06-24 18:30:41 -07001// RUN: %clang_analyze_cc1 %s \
2// RUN: -analyzer-checker=debug.AnalysisOrder \
3// RUN: -analyzer-config debug.AnalysisOrder:EvalCall=true \
4// RUN: -analyzer-config debug.AnalysisOrder:PreCall=true \
5// RUN: -analyzer-config debug.AnalysisOrder:PostCall=true \
6// RUN: 2>&1 | FileCheck %s
7
8// This test ensures that eval::Call event will be triggered for constructors.
9
10class C {
11public:
12 C(){};
13 C(int x){};
14 C(int x, int y){};
15};
16
17void foo() {
18 C C0;
19 C C1(42);
20 C *C2 = new C{2, 3};
21}
22
23// CHECK: PreCall (C::C) [CXXConstructorCall]
24// CHECK-NEXT: EvalCall (C::C) {argno: 0} [CXXConstructorCall]
25// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]
26// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]
27// CHECK-NEXT: EvalCall (C::C) {argno: 1} [CXXConstructorCall]
28// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]
29// CHECK-NEXT: PreCall (operator new) [CXXAllocatorCall]
30// CHECK-NEXT: PostCall (operator new) [CXXAllocatorCall]
31// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]
32// CHECK-NEXT: EvalCall (C::C) {argno: 2} [CXXConstructorCall]
33// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]