blob: 61de3153fd50966284dd6f57250724210422033f [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
Anders Carlssonf6c56e22009-11-25 03:15:49 +00008// CHECK: define void @_ZN1AC2Ev(%struct.A* %this)
9A::A() { }
10
11struct B : virtual A {
12 B();
13};
14
John McCall92ac9ff2010-02-17 03:52:49 +000015// CHECK: define void @_ZN1BC1Ev(%struct.B* %this)
John McCall8e51a1f2010-02-18 21:31:48 +000016// CHECK: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt)
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
John McCall92ac9ff2010-02-17 03:52:49 +000023// CHECK: define void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext)
John McCall8e51a1f2010-02-18 21:31:48 +000024// CHECK: define void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext)
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
42// CHECK: define void @_ZN6PR62511DC1Ev
43// CHECK: call void @_ZN6PR62511AIcEC2Ev
44// CHECK-NOT: call void @_ZN6PR62511AIcEC2Ev
45// CHECK: ret void
46D::D() { }
47
48}