Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s |
Anders Carlsson | 2f1986b | 2009-10-06 22:43:30 +0000 | [diff] [blame] | 2 | |
Eli Friedman | 8432f25 | 2009-11-28 03:31:34 +0000 | [diff] [blame] | 3 | struct A { int a; virtual int aa(); }; |
| 4 | struct B { int b; virtual int bb(); }; |
| 5 | struct C : virtual A, virtual B { int c; virtual int aa(); virtual int bb(); }; |
| 6 | struct AA { int a; virtual int aa(); }; |
| 7 | struct BB { int b; virtual int bb(); }; |
| 8 | struct CC : AA, BB { virtual int aa(); virtual int bb(); virtual int cc(); }; |
| 9 | struct D : virtual C, virtual CC { int e; }; |
Anders Carlsson | 2f1986b | 2009-10-06 22:43:30 +0000 | [diff] [blame] | 10 | |
Eli Friedman | 8432f25 | 2009-11-28 03:31:34 +0000 | [diff] [blame] | 11 | D* x; |
| 12 | |
| 13 | A* 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 | |
| 20 | B* 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 | |
| 27 | BB* 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: } |