blob: 1e78c9048db20a9f6bda08b6005075821b633f35 [file] [log] [blame]
Anders Carlsson1af3df82010-01-18 04:25:18 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2
3namespace Test1 {
4struct A { };
5
6struct B : virtual A {
7 virtual void f();
8};
9
10void B::f() { }
11}
12
13// Test1::B should just have a single entry in its VTT, which points to the vtable.
14// CHECK: @_ZTTN5Test11BE = constant [1 x i8*] [i8* bitcast (i8** getelementptr inbounds ([4 x i8*]* @_ZTVN5Test11BE, i64 0, i64 3) to i8*)]
15
16namespace Test2 {
17 struct A { };
18
19 struct B : A { virtual void f(); };
20 struct C : virtual B { };
21
22 C c;
23}
24
25// Check that we don't add a secondary virtual pointer for Test2::A, since Test2::A doesn't have any virtual member functions or bases.
26// CHECK: @_ZTTN5Test21CE = weak_odr constant [2 x i8*] [i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*)] ; <[2 x i8*]*> [#uses=0]