blob: c9f13f853d1bb143d59d25d920349964b9edcc10 [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 Carlssonf6c56e22009-11-25 03:15:49 +00002
3struct A {
4 A();
5};
6
John McCalld46f9852010-02-19 01:32:20 +00007// CHECK: @_ZN1AC1Ev = alias {{.*}} @_ZN1AC2Ev
Rafael Espindola0691a5c2011-01-25 19:10:24 +00008// CHECK: define void @_ZN1AC2Ev(%struct.A* %this) unnamed_addr
Anders Carlssonf6c56e22009-11-25 03:15:49 +00009A::A() { }
10
11struct B : virtual A {
12 B();
13};
14
Rafael Espindola0691a5c2011-01-25 19:10:24 +000015// CHECK: define void @_ZN1BC1Ev(%struct.B* %this) unnamed_addr
16// CHECK: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt) unnamed_addr
Anders Carlssonf6c56e22009-11-25 03:15:49 +000017B::B() { }
Anders Carlssonb2bcf1c2010-02-06 02:44:09 +000018
19struct C : virtual A {
20 C(bool);
21};
22
Chris Lattner9cbe4f02011-07-09 17:41:47 +000023// CHECK: define void @_ZN1CC1Eb(%struct.C* %this, i1 zeroext) unnamed_addr
24// CHECK: define void @_ZN1CC2Eb(%struct.C* %this, i8** %vtt, i1 zeroext) unnamed_addr
Anders Carlssonb2bcf1c2010-02-06 02:44:09 +000025C::C(bool) { }
Anders Carlsson1c363932010-03-29 19:49:09 +000026
27// PR6251
28namespace PR6251 {
29
30// Test that we don't call the A<char> constructor twice.
31
32template<typename T>
33struct A { A(); };
34
35struct B : virtual A<char> { };
36struct C : virtual A<char> { };
37
38struct D : B, C {
39 D();
40};
41
Rafael Espindola0691a5c2011-01-25 19:10:24 +000042// CHECK: define void @_ZN6PR62511DC1Ev(%"struct.PR6251::D"* %this) unnamed_addr
Anders Carlsson1c363932010-03-29 19:49:09 +000043// CHECK: call void @_ZN6PR62511AIcEC2Ev
44// CHECK-NOT: call void @_ZN6PR62511AIcEC2Ev
45// CHECK: ret void
46D::D() { }
47
48}