blob: 1cc8bcc7753ef4771bf624751396f9eb436abe25 [file] [log] [blame]
John McCalld46f9852010-02-19 01:32:20 +00001// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -mconstructor-aliases | FileCheck %s
Anders Carlssonfd126492009-12-04 19:33:17 +00002
John McCallc0bf4622010-02-23 00:48:20 +00003struct Member {
4 ~Member();
5};
6
Anders Carlssonfd126492009-12-04 19:33:17 +00007struct A {
8 virtual ~A();
9};
10
11struct B : A {
John McCallc0bf4622010-02-23 00:48:20 +000012 Member m;
Anders Carlssonfd126492009-12-04 19:33:17 +000013 virtual ~B();
14};
15
John McCalld46f9852010-02-19 01:32:20 +000016// Complete dtor: just an alias because there are no virtual bases.
17// CHECK: @_ZN1BD1Ev = alias {{.*}} @_ZN1BD2Ev
Anders Carlssonc997d422010-01-02 01:01:18 +000018
John McCallc0bf4622010-02-23 00:48:20 +000019// (aliases from C)
20// CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev
21// CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev
22
John McCall3b477332010-02-18 19:59:28 +000023// Deleting dtor: defers to the complete dtor.
Rafael Espindola0691a5c2011-01-25 19:10:24 +000024// CHECK: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
John McCall3b477332010-02-18 19:59:28 +000025// CHECK: call void @_ZN1BD1Ev
26// CHECK: call void @_ZdlPv
Anders Carlssonfd126492009-12-04 19:33:17 +000027
John McCall3b477332010-02-18 19:59:28 +000028// Base dtor: actually calls A's base dtor.
Rafael Espindola0691a5c2011-01-25 19:10:24 +000029// CHECK: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr
John McCallc0bf4622010-02-23 00:48:20 +000030// CHECK: call void @_ZN6MemberD1Ev
Anders Carlssonfd126492009-12-04 19:33:17 +000031// CHECK: call void @_ZN1AD2Ev
32
33B::~B() { }
John McCallc0bf4622010-02-23 00:48:20 +000034
35struct C : B {
36 ~C();
37};
38
39C::~C() { }
40
41// Complete dtor: just an alias (checked above).
42
43// Deleting dtor: defers to the complete dtor.
Rafael Espindola0691a5c2011-01-25 19:10:24 +000044// CHECK: define void @_ZN1CD0Ev(%struct.C* %this) unnamed_addr
John McCallc0bf4622010-02-23 00:48:20 +000045// CHECK: call void @_ZN1CD1Ev
46// CHECK: call void @_ZdlPv
47
48// Base dtor: just an alias to B's base dtor.