John McCall | d46f985 | 2010-02-19 01:32:20 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -mconstructor-aliases | FileCheck %s |
Anders Carlsson | fd12649 | 2009-12-04 19:33:17 +0000 | [diff] [blame] | 2 | |
John McCall | c0bf462 | 2010-02-23 00:48:20 +0000 | [diff] [blame] | 3 | struct Member { |
| 4 | ~Member(); |
| 5 | }; |
| 6 | |
Anders Carlsson | fd12649 | 2009-12-04 19:33:17 +0000 | [diff] [blame] | 7 | struct A { |
| 8 | virtual ~A(); |
| 9 | }; |
| 10 | |
| 11 | struct B : A { |
John McCall | c0bf462 | 2010-02-23 00:48:20 +0000 | [diff] [blame] | 12 | Member m; |
Anders Carlsson | fd12649 | 2009-12-04 19:33:17 +0000 | [diff] [blame] | 13 | virtual ~B(); |
| 14 | }; |
| 15 | |
John McCall | d46f985 | 2010-02-19 01:32:20 +0000 | [diff] [blame] | 16 | // Complete dtor: just an alias because there are no virtual bases. |
| 17 | // CHECK: @_ZN1BD1Ev = alias {{.*}} @_ZN1BD2Ev |
Anders Carlsson | c997d42 | 2010-01-02 01:01:18 +0000 | [diff] [blame] | 18 | |
John McCall | c0bf462 | 2010-02-23 00:48:20 +0000 | [diff] [blame] | 19 | // (aliases from C) |
| 20 | // CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev |
| 21 | // CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev |
| 22 | |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 23 | // Deleting dtor: defers to the complete dtor. |
Rafael Espindola | 0691a5c | 2011-01-25 19:10:24 +0000 | [diff] [blame] | 24 | // CHECK: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 25 | // CHECK: call void @_ZN1BD1Ev |
| 26 | // CHECK: call void @_ZdlPv |
Anders Carlsson | fd12649 | 2009-12-04 19:33:17 +0000 | [diff] [blame] | 27 | |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 28 | // Base dtor: actually calls A's base dtor. |
Rafael Espindola | 0691a5c | 2011-01-25 19:10:24 +0000 | [diff] [blame] | 29 | // CHECK: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr |
John McCall | c0bf462 | 2010-02-23 00:48:20 +0000 | [diff] [blame] | 30 | // CHECK: call void @_ZN6MemberD1Ev |
Anders Carlsson | fd12649 | 2009-12-04 19:33:17 +0000 | [diff] [blame] | 31 | // CHECK: call void @_ZN1AD2Ev |
| 32 | |
| 33 | B::~B() { } |
John McCall | c0bf462 | 2010-02-23 00:48:20 +0000 | [diff] [blame] | 34 | |
| 35 | struct C : B { |
| 36 | ~C(); |
| 37 | }; |
| 38 | |
| 39 | C::~C() { } |
| 40 | |
| 41 | // Complete dtor: just an alias (checked above). |
| 42 | |
| 43 | // Deleting dtor: defers to the complete dtor. |
Rafael Espindola | 0691a5c | 2011-01-25 19:10:24 +0000 | [diff] [blame] | 44 | // CHECK: define void @_ZN1CD0Ev(%struct.C* %this) unnamed_addr |
John McCall | c0bf462 | 2010-02-23 00:48:20 +0000 | [diff] [blame] | 45 | // CHECK: call void @_ZN1CD1Ev |
| 46 | // CHECK: call void @_ZdlPv |
| 47 | |
| 48 | // Base dtor: just an alias to B's base dtor. |