1 // RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
3 // An extra byte should be allocated for an empty class.
5 // CHECK: %"struct.Test1::A" = type { i8 }
10 // No need to add tail padding here.
11 // CHECK: %"struct.Test2::A" = type { ptr, i32 }
12 struct A
{ void *a
; int b
; } a
;
16 // C should have a vtable pointer.
17 // CHECK: %"struct.Test3::A" = type <{ ptr, i32, [4 x i8] }>
18 struct A
{ virtual void f(); int a
; } a
;
23 // CHECK: %"struct.Test4::B" = type { %"struct.Test4::A", i16, double }
24 // CHECK: %"struct.Test4::A" = type { i32, i8, float }
42 // CHECK: %"struct.Test5::B" = type { %"struct.Test5::A.base", i8, i8, [5 x i8] }
49 // PR10912: don't crash
51 template <typename T
> class A
{
52 // If T is complete, IR-gen will want to translate it recursively
53 // when translating T*.
59 // This causes IR-gen to have an incomplete translation of A<B>
65 // This forces Sema to instantiate A<B>, which triggers a callback
66 // to IR-gen. Because of the previous, incomplete translation,
67 // IR-gen actually cares, and it immediately tries to complete
68 // A<B>'s IR type. That, in turn, causes the translation of B*.
69 // B isn't complete yet, but it has a definition, and if we try to
70 // compute a record layout for that definition then we'll really
75 // The derived class E and empty base class C are required to
76 // provoke the original assertion.
77 class E
: public B
{};
81 // Make sure this doesn't crash. (It's okay if we start rejecting it at some
86 // CHECK: %"class.Test7::B" = type <{ ptr, %"class.Test7::A" }>
91 B
test(B b
) { return b
; }
99 struct B
: virtual D
, A
{ };
100 struct C
: B
, A
{ void f() {} };