xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/dtors-in-dtor-cfg-output.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc class A {
4*f4a2713aSLionel Sambuc public:
~A()5*f4a2713aSLionel Sambuc   ~A() {}
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc class B : public virtual A {
9*f4a2713aSLionel Sambuc public:
~B()10*f4a2713aSLionel Sambuc   ~B() {}
11*f4a2713aSLionel Sambuc };
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc class C : public virtual A {
14*f4a2713aSLionel Sambuc public:
~C()15*f4a2713aSLionel Sambuc   ~C() {}
16*f4a2713aSLionel Sambuc };
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc class TestOrder : public C, public B, public virtual A {
19*f4a2713aSLionel Sambuc   A a;
20*f4a2713aSLionel Sambuc   int i;
21*f4a2713aSLionel Sambuc   A *p;
22*f4a2713aSLionel Sambuc public:
23*f4a2713aSLionel Sambuc   ~TestOrder();
24*f4a2713aSLionel Sambuc };
25*f4a2713aSLionel Sambuc 
~TestOrder()26*f4a2713aSLionel Sambuc TestOrder::~TestOrder() {}
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc class TestArray {
29*f4a2713aSLionel Sambuc   A a[2];
30*f4a2713aSLionel Sambuc   A b[0];
31*f4a2713aSLionel Sambuc public:
32*f4a2713aSLionel Sambuc   ~TestArray();
33*f4a2713aSLionel Sambuc };
34*f4a2713aSLionel Sambuc 
~TestArray()35*f4a2713aSLionel Sambuc TestArray::~TestArray() {}
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc // CHECK:  [B2 (ENTRY)]
38*f4a2713aSLionel Sambuc // CHECK:    Succs (1): B1
39*f4a2713aSLionel Sambuc // CHECK:  [B1]
40*f4a2713aSLionel Sambuc // CHECK:    1: this->a.~A() (Member object destructor)
41*f4a2713aSLionel Sambuc // CHECK:    2: ~B() (Base object destructor)
42*f4a2713aSLionel Sambuc // CHECK:    3: ~C() (Base object destructor)
43*f4a2713aSLionel Sambuc // CHECK:    4: ~A() (Base object destructor)
44*f4a2713aSLionel Sambuc // CHECK:    Preds (1): B2
45*f4a2713aSLionel Sambuc // CHECK:    Succs (1): B0
46*f4a2713aSLionel Sambuc // CHECK:  [B0 (EXIT)]
47*f4a2713aSLionel Sambuc // CHECK:    Preds (1): B1
48*f4a2713aSLionel Sambuc // CHECK:  [B2 (ENTRY)]
49*f4a2713aSLionel Sambuc // CHECK:    Succs (1): B1
50*f4a2713aSLionel Sambuc // CHECK:  [B1]
51*f4a2713aSLionel Sambuc // CHECK:    1: this->a.~A() (Member object destructor)
52*f4a2713aSLionel Sambuc // CHECK:    Preds (1): B2
53*f4a2713aSLionel Sambuc // CHECK:    Succs (1): B0
54*f4a2713aSLionel Sambuc // CHECK:  [B0 (EXIT)]
55*f4a2713aSLionel Sambuc // CHECK:    Preds (1): B1
56