blob: 73b7c1c95299b9b16c2abada6ae0fa9419b60e63 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s
Anders Carlsson2f1986b2009-10-06 22:43:30 +00002
Eli Friedman8432f252009-11-28 03:31:34 +00003struct A { int a; virtual int aa(); };
4struct B { int b; virtual int bb(); };
5struct C : virtual A, virtual B { int c; virtual int aa(); virtual int bb(); };
6struct AA { int a; virtual int aa(); };
7struct BB { int b; virtual int bb(); };
8struct CC : AA, BB { virtual int aa(); virtual int bb(); virtual int cc(); };
9struct D : virtual C, virtual CC { int e; };
Anders Carlsson2f1986b2009-10-06 22:43:30 +000010
Eli Friedman8432f252009-11-28 03:31:34 +000011D* x;
12
13A* a() { return x; }
14// CHECK: @_Z1av() nounwind
15// CHECK: [[VBASEOFFSETPTRA:%[a-zA-Z0-9\.]+]] = getelementptr i8* {{.*}}, i64 -16
16// CHECK: [[CASTVBASEOFFSETPTRA:%[a-zA-Z0-9\.]+]] = bitcast i8* [[VBASEOFFSETPTRA]] to i32*
17// CHECK: load i32* [[CASTVBASEOFFSETPTRA]]
18// CHECK: }
19
20B* b() { return x; }
21// CHECK: @_Z1bv() nounwind
22// CHECK: [[VBASEOFFSETPTRA:%[a-zA-Z0-9\.]+]] = getelementptr i8* {{.*}}, i64 -20
23// CHECK: [[CASTVBASEOFFSETPTRA:%[a-zA-Z0-9\.]+]] = bitcast i8* [[VBASEOFFSETPTRA]] to i32*
24// CHECK: load i32* [[CASTVBASEOFFSETPTRA]]
25// CHECK: }
26
27BB* c() { return x; }
28// CHECK: @_Z1cv() nounwind
29// CHECK: [[VBASEOFFSETPTRC:%[a-zA-Z0-9\.]+]] = getelementptr i8* {{.*}}, i64 -24
30// CHECK: [[CASTVBASEOFFSETPTRC:%[a-zA-Z0-9\.]+]] = bitcast i8* [[VBASEOFFSETPTRC]] to i32*
31// CHECK: [[VBASEOFFSETC:%[a-zA-Z0-9\.]+]] = load i32* [[CASTVBASEOFFSETPTRC]]
32// CHECK: add i32 [[VBASEOFFSETC]], 8
33// CHECK: }