51 lines · cpp
1// RUN: %clang_analyze_cc1 %s \2// RUN: -analyzer-checker=debug.AnalysisOrder \3// RUN: -analyzer-config debug.AnalysisOrder:PreCall=true \4// RUN: -analyzer-config debug.AnalysisOrder:PostCall=true \5// RUN: 2>&1 | FileCheck %s6 7// This test ensures that eval::Call event will be triggered for constructors.8 9class C {10public:11 C(){};12};13 14void stack() {15 C arr[4];16 C *arr2 = new C[4];17 C arr3[2][2];18}19 20// C arr[4];21// CHECK: PreCall (C::C) [CXXConstructorCall]22// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]23// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]24// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]25// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]26// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]27// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]28// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]29//30// C *arr2 = new C[4];31// CHECK-NEXT: PreCall (operator new[]) [CXXAllocatorCall]32// CHECK-NEXT: PostCall (operator new[]) [CXXAllocatorCall]33// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]34// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]35// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]36// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]37// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]38// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]39// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]40// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]41//42// C arr3[2][2];43// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]44// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]45// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]46// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]47// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]48// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]49// CHECK-NEXT: PreCall (C::C) [CXXConstructorCall]50// CHECK-NEXT: PostCall (C::C) [CXXConstructorCall]51