head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC5:1.1.1.3
	netbsd-11-0-RC4:1.1.1.3
	netbsd-11-0-RC3:1.1.1.3
	netbsd-11-0-RC2:1.1.1.3
	netbsd-11-0-RC1:1.1.1.3
	perseant-exfatfs-base-20250801:1.1.1.3
	netbsd-11:1.1.1.3.0.10
	netbsd-11-base:1.1.1.3
	netbsd-10-1-RELEASE:1.1.1.3
	perseant-exfatfs-base-20240630:1.1.1.3
	perseant-exfatfs:1.1.1.3.0.8
	perseant-exfatfs-base:1.1.1.3
	netbsd-8-3-RELEASE:1.1.1.2
	netbsd-9-4-RELEASE:1.1.1.2
	netbsd-10-0-RELEASE:1.1.1.3
	netbsd-10-0-RC6:1.1.1.3
	netbsd-10-0-RC5:1.1.1.3
	netbsd-10-0-RC4:1.1.1.3
	netbsd-10-0-RC3:1.1.1.3
	netbsd-10-0-RC2:1.1.1.3
	netbsd-10-0-RC1:1.1.1.3
	netbsd-10:1.1.1.3.0.6
	netbsd-10-base:1.1.1.3
	netbsd-9-3-RELEASE:1.1.1.2
	cjep_sun2x:1.1.1.3.0.4
	cjep_sun2x-base:1.1.1.3
	cjep_staticlib_x-base1:1.1.1.3
	netbsd-9-2-RELEASE:1.1.1.2
	cjep_staticlib_x:1.1.1.3.0.2
	cjep_staticlib_x-base:1.1.1.3
	netbsd-9-1-RELEASE:1.1.1.2
	phil-wifi-20200421:1.1.1.3
	phil-wifi-20200411:1.1.1.3
	phil-wifi-20200406:1.1.1.3
	netbsd-8-2-RELEASE:1.1.1.2
	netbsd-9-0-RELEASE:1.1.1.2
	netbsd-9-0-RC2:1.1.1.2
	netbsd-9-0-RC1:1.1.1.2
	netbsd-9:1.1.1.2.0.32
	netbsd-9-base:1.1.1.2
	phil-wifi-20190609:1.1.1.2
	netbsd-8-1-RELEASE:1.1.1.2
	netbsd-8-1-RC1:1.1.1.2
	pgoyette-compat-merge-20190127:1.1.1.2
	pgoyette-compat-20190127:1.1.1.2
	pgoyette-compat-20190118:1.1.1.2
	pgoyette-compat-1226:1.1.1.2
	pgoyette-compat-1126:1.1.1.2
	pgoyette-compat-1020:1.1.1.2
	pgoyette-compat-0930:1.1.1.2
	pgoyette-compat-0906:1.1.1.2
	netbsd-7-2-RELEASE:1.1.1.2
	pgoyette-compat-0728:1.1.1.2
	clang-337282:1.1.1.2
	netbsd-8-0-RELEASE:1.1.1.2
	phil-wifi:1.1.1.2.0.30
	phil-wifi-base:1.1.1.2
	pgoyette-compat-0625:1.1.1.2
	netbsd-8-0-RC2:1.1.1.2
	pgoyette-compat-0521:1.1.1.2
	pgoyette-compat-0502:1.1.1.2
	pgoyette-compat-0422:1.1.1.2
	netbsd-8-0-RC1:1.1.1.2
	pgoyette-compat-0415:1.1.1.2
	pgoyette-compat-0407:1.1.1.2
	pgoyette-compat-0330:1.1.1.2
	pgoyette-compat-0322:1.1.1.2
	pgoyette-compat-0315:1.1.1.2
	netbsd-7-1-2-RELEASE:1.1.1.2
	pgoyette-compat:1.1.1.2.0.28
	pgoyette-compat-base:1.1.1.2
	netbsd-7-1-1-RELEASE:1.1.1.2
	clang-319952:1.1.1.2
	matt-nb8-mediatek:1.1.1.2.0.26
	matt-nb8-mediatek-base:1.1.1.2
	clang-309604:1.1.1.2
	perseant-stdc-iso10646:1.1.1.2.0.24
	perseant-stdc-iso10646-base:1.1.1.2
	netbsd-8:1.1.1.2.0.22
	netbsd-8-base:1.1.1.2
	prg-localcount2-base3:1.1.1.2
	prg-localcount2-base2:1.1.1.2
	prg-localcount2-base1:1.1.1.2
	prg-localcount2:1.1.1.2.0.20
	prg-localcount2-base:1.1.1.2
	pgoyette-localcount-20170426:1.1.1.2
	bouyer-socketcan-base1:1.1.1.2
	pgoyette-localcount-20170320:1.1.1.2
	netbsd-7-1:1.1.1.2.0.18
	netbsd-7-1-RELEASE:1.1.1.2
	netbsd-7-1-RC2:1.1.1.2
	clang-294123:1.1.1.2
	netbsd-7-nhusb-base-20170116:1.1.1.2
	bouyer-socketcan:1.1.1.2.0.16
	bouyer-socketcan-base:1.1.1.2
	clang-291444:1.1.1.2
	pgoyette-localcount-20170107:1.1.1.2
	netbsd-7-1-RC1:1.1.1.2
	pgoyette-localcount-20161104:1.1.1.2
	netbsd-7-0-2-RELEASE:1.1.1.2
	localcount-20160914:1.1.1.2
	netbsd-7-nhusb:1.1.1.2.0.14
	netbsd-7-nhusb-base:1.1.1.2
	clang-280599:1.1.1.2
	pgoyette-localcount-20160806:1.1.1.2
	pgoyette-localcount-20160726:1.1.1.2
	pgoyette-localcount:1.1.1.2.0.12
	pgoyette-localcount-base:1.1.1.2
	netbsd-7-0-1-RELEASE:1.1.1.2
	clang-261930:1.1.1.2
	netbsd-7-0:1.1.1.2.0.10
	netbsd-7-0-RELEASE:1.1.1.2
	netbsd-7-0-RC3:1.1.1.2
	netbsd-7-0-RC2:1.1.1.2
	netbsd-7-0-RC1:1.1.1.2
	clang-237755:1.1.1.2
	clang-232565:1.1.1.2
	clang-227398:1.1.1.2
	tls-maxphys-base:1.1.1.2
	tls-maxphys:1.1.1.2.0.8
	netbsd-7:1.1.1.2.0.6
	netbsd-7-base:1.1.1.2
	clang-215315:1.1.1.2
	clang-209886:1.1.1.2
	yamt-pagecache:1.1.1.2.0.4
	yamt-pagecache-base9:1.1.1.2
	tls-earlyentropy:1.1.1.2.0.2
	tls-earlyentropy-base:1.1.1.2
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.2
	riastradh-drm2-base3:1.1.1.2
	clang-202566:1.1.1.2
	clang-201163:1.1.1.1
	clang-199312:1.1.1.1
	clang-198450:1.1.1.1
	clang-196603:1.1.1.1
	clang-195771:1.1.1.1
	LLVM:1.1.1;
locks; strict;
comment	@// @;


1.1
date	2013.11.28.14.14.58;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	ow8OybrawrB1f3fx;

1.1.1.1
date	2013.11.28.14.14.58;	author joerg;	state Exp;
branches;
next	1.1.1.2;
commitid	ow8OybrawrB1f3fx;

1.1.1.2
date	2014.03.04.19.55.42;	author joerg;	state Exp;
branches
	1.1.1.2.4.1
	1.1.1.2.8.1
	1.1.1.2.30.1;
next	1.1.1.3;
commitid	29z1hJonZISIXprx;

1.1.1.3
date	2019.11.13.22.20.16;	author joerg;	state dead;
branches;
next	;
commitid	QD8YATxuNG34YJKB;

1.1.1.2.4.1
date	2014.03.04.19.55.42;	author yamt;	state dead;
branches;
next	1.1.1.2.4.2;
commitid	WSrDtL5nYAUyiyBx;

1.1.1.2.4.2
date	2014.05.22.16.18.57;	author yamt;	state Exp;
branches;
next	;
commitid	WSrDtL5nYAUyiyBx;

1.1.1.2.8.1
date	2014.03.04.19.55.42;	author tls;	state dead;
branches;
next	1.1.1.2.8.2;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.2.8.2
date	2014.08.19.23.47.59;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.2.30.1
date	2020.04.13.07.47.29;	author martin;	state dead;
branches;
next	;
commitid	X01YhRUPVUDaec4C;


desc
@@


1.1
log
@Initial revision
@
text
@// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>&1
// RUN: FileCheck --check-prefix=CHECK-1 %s < %t
// RUN: FileCheck --check-prefix=CHECK-2 %s < %t
// RUN: FileCheck --check-prefix=CHECK-3 %s < %t
// RUN: FileCheck --check-prefix=CHECK-4 %s < %t
// RUN: FileCheck --check-prefix=CHECK-5 %s < %t
// RUN: FileCheck --check-prefix=CHECK-6 %s < %t
// RUN: FileCheck --check-prefix=CHECK-7 %s < %t
// RUN: FileCheck --check-prefix=CHECK-8 %s < %t
// RUN: FileCheck --check-prefix=CHECK-9 %s < %t
// RUN: FileCheck --check-prefix=CHECK-10 %s < %t
// RUN: FileCheck --check-prefix=CHECK-11 %s < %t

/// Examples from the Itanium C++ ABI specification.
/// http://www.codesourcery.com/public/cxx-abi/

namespace Test1 {
  
// This is from http://www.codesourcery.com/public/cxx-abi/cxx-vtable-ex.html

// CHECK-1:      Vtable for 'Test1::A' (5 entries).
// CHECK-1-NEXT:    0 | offset_to_top (0)
// CHECK-1-NEXT:    1 | Test1::A RTTI
// CHECK-1-NEXT:        -- (Test1::A, 0) vtable address --
// CHECK-1-NEXT:    2 | void Test1::A::f()
// CHECK-1-NEXT:    3 | void Test1::A::g()
// CHECK-1-NEXT:    4 | void Test1::A::h()
struct A {
  virtual void f ();
  virtual void g ();
  virtual void h ();
  int ia;
};
void A::f() {}

// CHECK-2:      Vtable for 'Test1::B' (13 entries).
// CHECK-2-NEXT:    0 | vbase_offset (16)
// CHECK-2-NEXT:    1 | offset_to_top (0)
// CHECK-2-NEXT:    2 | Test1::B RTTI
// CHECK-2-NEXT:        -- (Test1::B, 0) vtable address --
// CHECK-2-NEXT:    3 | void Test1::B::f()
// CHECK-2-NEXT:    4 | void Test1::B::h()
// CHECK-2-NEXT:    5 | vcall_offset (-16)
// CHECK-2-NEXT:    6 | vcall_offset (0)
// CHECK-2-NEXT:    7 | vcall_offset (-16)
// CHECK-2-NEXT:    8 | offset_to_top (-16)
// CHECK-2-NEXT:    9 | Test1::B RTTI
// CHECK-2-NEXT:        -- (Test1::A, 16) vtable address --
// CHECK-2-NEXT:   10 | void Test1::B::f()
// CHECK-2-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-2-NEXT:   11 | void Test1::A::g()
// CHECK-2-NEXT:   12 | void Test1::B::h()
// CHECK-2-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct B: public virtual A {
  void f ();
  void h ();
  int ib;
};
void B::f() {}

// CHECK-3:      Vtable for 'Test1::C' (13 entries).
// CHECK-3-NEXT:    0 | vbase_offset (16)
// CHECK-3-NEXT:    1 | offset_to_top (0)
// CHECK-3-NEXT:    2 | Test1::C RTTI
// CHECK-3-NEXT:        -- (Test1::C, 0) vtable address --
// CHECK-3-NEXT:    3 | void Test1::C::g()
// CHECK-3-NEXT:    4 | void Test1::C::h()
// CHECK-3-NEXT:    5 | vcall_offset (-16)
// CHECK-3-NEXT:    6 | vcall_offset (-16)
// CHECK-3-NEXT:    7 | vcall_offset (0)
// CHECK-3-NEXT:    8 | offset_to_top (-16)
// CHECK-3-NEXT:    9 | Test1::C RTTI
// CHECK-3-NEXT:        -- (Test1::A, 16) vtable address --
// CHECK-3-NEXT:   10 | void Test1::A::f()
// CHECK-3-NEXT:   11 | void Test1::C::g()
// CHECK-3-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-3-NEXT:   12 | void Test1::C::h()
// CHECK-3-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct C: public virtual A {
  void g ();
  void h ();
  int ic;
};
void C::g() {}

// CHECK-4:      Vtable for 'Test1::D' (18 entries).
// CHECK-4-NEXT:    0 | vbase_offset (32)
// CHECK-4-NEXT:    1 | offset_to_top (0)
// CHECK-4-NEXT:    2 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::B, 0) vtable address --
// CHECK-4-NEXT:        -- (Test1::D, 0) vtable address --
// CHECK-4-NEXT:    3 | void Test1::B::f()
// CHECK-4-NEXT:    4 | void Test1::D::h()
// CHECK-4-NEXT:    5 | vbase_offset (16)
// CHECK-4-NEXT:    6 | offset_to_top (-16)
// CHECK-4-NEXT:    7 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::C, 16) vtable address --
// CHECK-4-NEXT:    8 | void Test1::C::g()
// CHECK-4-NEXT:    9 | void Test1::D::h()
// CHECK-4-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-4-NEXT:   10 | vcall_offset (-32)
// CHECK-4-NEXT:   11 | vcall_offset (-16)
// CHECK-4-NEXT:   12 | vcall_offset (-32)
// CHECK-4-NEXT:   13 | offset_to_top (-32)
// CHECK-4-NEXT:   14 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::A, 32) vtable address --
// CHECK-4-NEXT:   15 | void Test1::B::f()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-4-NEXT:   16 | void Test1::C::g()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-4-NEXT:   17 | void Test1::D::h()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct D: public B, public C {
  void h ();
  int id;
};
void D::h() { }

struct X {
  int ix;
  virtual void x();
};

// CHECK-5:      Vtable for 'Test1::E' (24 entries).
// CHECK-5-NEXT:    0 | vbase_offset (56)
// CHECK-5-NEXT:    1 | offset_to_top (0)
// CHECK-5-NEXT:    2 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::E, 0) vtable address --
// CHECK-5-NEXT:        -- (Test1::X, 0) vtable address --
// CHECK-5-NEXT:    3 | void Test1::X::x()
// CHECK-5-NEXT:    4 | void Test1::E::f()
// CHECK-5-NEXT:    5 | void Test1::E::h()
// CHECK-5-NEXT:    6 | vbase_offset (40)
// CHECK-5-NEXT:    7 | offset_to_top (-16)
// CHECK-5-NEXT:    8 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::B, 16) vtable address --
// CHECK-5-NEXT:        -- (Test1::D, 16) vtable address --
// CHECK-5-NEXT:    9 | void Test1::E::f()
// CHECK-5-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-5-NEXT:   10 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-5-NEXT:   11 | vbase_offset (24)
// CHECK-5-NEXT:   12 | offset_to_top (-32)
// CHECK-5-NEXT:   13 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::C, 32) vtable address --
// CHECK-5-NEXT:   14 | void Test1::C::g()
// CHECK-5-NEXT:   15 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: -32 non-virtual]
// CHECK-5-NEXT:   16 | vcall_offset (-56)
// CHECK-5-NEXT:   17 | vcall_offset (-24)
// CHECK-5-NEXT:   18 | vcall_offset (-56)
// CHECK-5-NEXT:   19 | offset_to_top (-56)
// CHECK-5-NEXT:   20 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::A, 56) vtable address --
// CHECK-5-NEXT:   21 | void Test1::E::f()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-5-NEXT:   22 | void Test1::C::g()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-5-NEXT:   23 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct E : X, D {
  int ie;
  void f();
  void h ();
};
void E::f() { } 

}

namespace Test2 {

// From http://www.codesourcery.com/public/cxx-abi/abi.html#class-types.

struct A { virtual void f(); };
struct B : virtual public A { int i; };
struct C : virtual public A { int j; };

// CHECK-6:      Vtable for 'Test2::D' (11 entries).
// CHECK-6-NEXT:    0 | vbase_offset (0)
// CHECK-6-NEXT:    1 | vcall_offset (0)
// CHECK-6-NEXT:    2 | offset_to_top (0)
// CHECK-6-NEXT:    3 | Test2::D RTTI
// CHECK-6-NEXT:        -- (Test2::A, 0) vtable address --
// CHECK-6-NEXT:        -- (Test2::B, 0) vtable address --
// CHECK-6-NEXT:        -- (Test2::D, 0) vtable address --
// CHECK-6-NEXT:    4 | void Test2::A::f()
// CHECK-6-NEXT:    5 | void Test2::D::d()
// CHECK-6-NEXT:    6 | vbase_offset (-16)
// CHECK-6-NEXT:    7 | vcall_offset (-16)
// CHECK-6-NEXT:    8 | offset_to_top (-16)
// CHECK-6-NEXT:    9 | Test2::D RTTI
// CHECK-6-NEXT:        -- (Test2::C, 16) vtable address --
// CHECK-6-NEXT:   10 | [unused] void Test2::A::f()
struct D : public B, public C {
  virtual void d();
};
void D::d() { } 

}

namespace Test3 {

// From http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor

struct V1 {
  int v1;
  virtual void f();
};

struct V2 : virtual V1 {
  int v2;
  virtual void f();
};

// CHECK-7:      Vtable for 'Test3::C' (14 entries).
// CHECK-7-NEXT:    0 | vbase_offset (32)
// CHECK-7-NEXT:    1 | vbase_offset (16)
// CHECK-7-NEXT:    2 | offset_to_top (0)
// CHECK-7-NEXT:    3 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-7-NEXT:    4 | void Test3::C::f()
// CHECK-7-NEXT:    5 | vcall_offset (-16)
// CHECK-7-NEXT:    6 | offset_to_top (-16)
// CHECK-7-NEXT:    7 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::V1, 16) vtable address --
// CHECK-7-NEXT:    8 | void Test3::C::f()
// CHECK-7-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-7-NEXT:    9 | vcall_offset (-32)
// CHECK-7-NEXT:   10 | vbase_offset (-16)
// CHECK-7-NEXT:   11 | offset_to_top (-32)
// CHECK-7-NEXT:   12 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::V2, 32) vtable address --
// CHECK-7-NEXT:   13 | void Test3::C::f()
// CHECK-7-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-8:      Construction vtable for ('Test3::V2', 32) in 'Test3::C' (9 entries).
// CHECK-8-NEXT:    0 | vcall_offset (0)
// CHECK-8-NEXT:    1 | vbase_offset (-16)
// CHECK-8-NEXT:    2 | offset_to_top (0)
// CHECK-8-NEXT:    3 | Test3::V2 RTTI
// CHECK-8-NEXT:        -- (Test3::V2, 32) vtable address --
// CHECK-8-NEXT:    4 | void Test3::V2::f()
// CHECK-8-NEXT:    5 | vcall_offset (16)
// CHECK-8-NEXT:    6 | offset_to_top (16)
// CHECK-8-NEXT:    7 | Test3::V2 RTTI
// CHECK-8-NEXT:        -- (Test3::V1, 16) vtable address --
// CHECK-8-NEXT:    8 | void Test3::V2::f()
// CHECK-8-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct C : virtual V1, virtual V2 {
  int c;
  virtual void f();
};
void C::f() { }

struct B {
  int b;
};

// CHECK-9:      Vtable for 'Test3::D' (15 entries).
// CHECK-9-NEXT:    0 | vbase_offset (40)
// CHECK-9-NEXT:    1 | vbase_offset (24)
// CHECK-9-NEXT:    2 | offset_to_top (0)
// CHECK-9-NEXT:    3 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-9-NEXT:        -- (Test3::D, 0) vtable address --
// CHECK-9-NEXT:    4 | void Test3::C::f()
// CHECK-9-NEXT:    5 | void Test3::D::g()
// CHECK-9-NEXT:    6 | vcall_offset (-24)
// CHECK-9-NEXT:    7 | offset_to_top (-24)
// CHECK-9-NEXT:    8 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-9-NEXT:    9 | void Test3::C::f()
// CHECK-9-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-9-NEXT:   10 | vcall_offset (-40)
// CHECK-9-NEXT:   11 | vbase_offset (-16)
// CHECK-9-NEXT:   12 | offset_to_top (-40)
// CHECK-9-NEXT:   13 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-9-NEXT:   14 | void Test3::C::f()
// CHECK-9-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-10:      Construction vtable for ('Test3::C', 0) in 'Test3::D' (14 entries).
// CHECK-10-NEXT:    0 | vbase_offset (40)
// CHECK-10-NEXT:    1 | vbase_offset (24)
// CHECK-10-NEXT:    2 | offset_to_top (0)
// CHECK-10-NEXT:    3 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-10-NEXT:    4 | void Test3::C::f()
// CHECK-10-NEXT:    5 | vcall_offset (-24)
// CHECK-10-NEXT:    6 | offset_to_top (-24)
// CHECK-10-NEXT:    7 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-10-NEXT:    8 | void Test3::C::f()
// CHECK-10-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-10-NEXT:    9 | vcall_offset (-40)
// CHECK-10-NEXT:   10 | vbase_offset (-16)
// CHECK-10-NEXT:   11 | offset_to_top (-40)
// CHECK-10-NEXT:   12 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-10-NEXT:   13 | void Test3::C::f()
// CHECK-10-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-11:      Construction vtable for ('Test3::V2', 40) in 'Test3::D' (9 entries).
// CHECK-11-NEXT:    0 | vcall_offset (0)
// CHECK-11-NEXT:    1 | vbase_offset (-16)
// CHECK-11-NEXT:    2 | offset_to_top (0)
// CHECK-11-NEXT:    3 | Test3::V2 RTTI
// CHECK-11-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-11-NEXT:    4 | void Test3::V2::f()
// CHECK-11-NEXT:    5 | vcall_offset (16)
// CHECK-11-NEXT:    6 | offset_to_top (16)
// CHECK-11-NEXT:    7 | Test3::V2 RTTI
// CHECK-11-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-11-NEXT:    8 | void Test3::V2::f()
// CHECK-11-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct D : B, C {
  int d;
  virtual void g();
};
void D::g() { }

}
@


1.1.1.1
log
@Import Clang 3.4rc1 r195771.
@
text
@@


1.1.1.2
log
@Import Clang 3.5svn r202566.
@
text
@d1 1
a1 1
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>/dev/null
@


1.1.1.2.30.1
log
@Mostly merge changes from HEAD upto 20200411
@
text
@@


1.1.1.3
log
@Mark old LLVM instance as dead.
@
text
@@


1.1.1.2.8.1
log
@file vtable-layout-abi-examples.cpp was added on branch tls-maxphys on 2014-08-19 23:47:59 +0000
@
text
@d1 322
@


1.1.1.2.8.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a0 322
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>/dev/null
// RUN: FileCheck --check-prefix=CHECK-1 %s < %t
// RUN: FileCheck --check-prefix=CHECK-2 %s < %t
// RUN: FileCheck --check-prefix=CHECK-3 %s < %t
// RUN: FileCheck --check-prefix=CHECK-4 %s < %t
// RUN: FileCheck --check-prefix=CHECK-5 %s < %t
// RUN: FileCheck --check-prefix=CHECK-6 %s < %t
// RUN: FileCheck --check-prefix=CHECK-7 %s < %t
// RUN: FileCheck --check-prefix=CHECK-8 %s < %t
// RUN: FileCheck --check-prefix=CHECK-9 %s < %t
// RUN: FileCheck --check-prefix=CHECK-10 %s < %t
// RUN: FileCheck --check-prefix=CHECK-11 %s < %t

/// Examples from the Itanium C++ ABI specification.
/// http://www.codesourcery.com/public/cxx-abi/

namespace Test1 {
  
// This is from http://www.codesourcery.com/public/cxx-abi/cxx-vtable-ex.html

// CHECK-1:      Vtable for 'Test1::A' (5 entries).
// CHECK-1-NEXT:    0 | offset_to_top (0)
// CHECK-1-NEXT:    1 | Test1::A RTTI
// CHECK-1-NEXT:        -- (Test1::A, 0) vtable address --
// CHECK-1-NEXT:    2 | void Test1::A::f()
// CHECK-1-NEXT:    3 | void Test1::A::g()
// CHECK-1-NEXT:    4 | void Test1::A::h()
struct A {
  virtual void f ();
  virtual void g ();
  virtual void h ();
  int ia;
};
void A::f() {}

// CHECK-2:      Vtable for 'Test1::B' (13 entries).
// CHECK-2-NEXT:    0 | vbase_offset (16)
// CHECK-2-NEXT:    1 | offset_to_top (0)
// CHECK-2-NEXT:    2 | Test1::B RTTI
// CHECK-2-NEXT:        -- (Test1::B, 0) vtable address --
// CHECK-2-NEXT:    3 | void Test1::B::f()
// CHECK-2-NEXT:    4 | void Test1::B::h()
// CHECK-2-NEXT:    5 | vcall_offset (-16)
// CHECK-2-NEXT:    6 | vcall_offset (0)
// CHECK-2-NEXT:    7 | vcall_offset (-16)
// CHECK-2-NEXT:    8 | offset_to_top (-16)
// CHECK-2-NEXT:    9 | Test1::B RTTI
// CHECK-2-NEXT:        -- (Test1::A, 16) vtable address --
// CHECK-2-NEXT:   10 | void Test1::B::f()
// CHECK-2-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-2-NEXT:   11 | void Test1::A::g()
// CHECK-2-NEXT:   12 | void Test1::B::h()
// CHECK-2-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct B: public virtual A {
  void f ();
  void h ();
  int ib;
};
void B::f() {}

// CHECK-3:      Vtable for 'Test1::C' (13 entries).
// CHECK-3-NEXT:    0 | vbase_offset (16)
// CHECK-3-NEXT:    1 | offset_to_top (0)
// CHECK-3-NEXT:    2 | Test1::C RTTI
// CHECK-3-NEXT:        -- (Test1::C, 0) vtable address --
// CHECK-3-NEXT:    3 | void Test1::C::g()
// CHECK-3-NEXT:    4 | void Test1::C::h()
// CHECK-3-NEXT:    5 | vcall_offset (-16)
// CHECK-3-NEXT:    6 | vcall_offset (-16)
// CHECK-3-NEXT:    7 | vcall_offset (0)
// CHECK-3-NEXT:    8 | offset_to_top (-16)
// CHECK-3-NEXT:    9 | Test1::C RTTI
// CHECK-3-NEXT:        -- (Test1::A, 16) vtable address --
// CHECK-3-NEXT:   10 | void Test1::A::f()
// CHECK-3-NEXT:   11 | void Test1::C::g()
// CHECK-3-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-3-NEXT:   12 | void Test1::C::h()
// CHECK-3-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct C: public virtual A {
  void g ();
  void h ();
  int ic;
};
void C::g() {}

// CHECK-4:      Vtable for 'Test1::D' (18 entries).
// CHECK-4-NEXT:    0 | vbase_offset (32)
// CHECK-4-NEXT:    1 | offset_to_top (0)
// CHECK-4-NEXT:    2 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::B, 0) vtable address --
// CHECK-4-NEXT:        -- (Test1::D, 0) vtable address --
// CHECK-4-NEXT:    3 | void Test1::B::f()
// CHECK-4-NEXT:    4 | void Test1::D::h()
// CHECK-4-NEXT:    5 | vbase_offset (16)
// CHECK-4-NEXT:    6 | offset_to_top (-16)
// CHECK-4-NEXT:    7 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::C, 16) vtable address --
// CHECK-4-NEXT:    8 | void Test1::C::g()
// CHECK-4-NEXT:    9 | void Test1::D::h()
// CHECK-4-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-4-NEXT:   10 | vcall_offset (-32)
// CHECK-4-NEXT:   11 | vcall_offset (-16)
// CHECK-4-NEXT:   12 | vcall_offset (-32)
// CHECK-4-NEXT:   13 | offset_to_top (-32)
// CHECK-4-NEXT:   14 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::A, 32) vtable address --
// CHECK-4-NEXT:   15 | void Test1::B::f()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-4-NEXT:   16 | void Test1::C::g()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-4-NEXT:   17 | void Test1::D::h()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct D: public B, public C {
  void h ();
  int id;
};
void D::h() { }

struct X {
  int ix;
  virtual void x();
};

// CHECK-5:      Vtable for 'Test1::E' (24 entries).
// CHECK-5-NEXT:    0 | vbase_offset (56)
// CHECK-5-NEXT:    1 | offset_to_top (0)
// CHECK-5-NEXT:    2 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::E, 0) vtable address --
// CHECK-5-NEXT:        -- (Test1::X, 0) vtable address --
// CHECK-5-NEXT:    3 | void Test1::X::x()
// CHECK-5-NEXT:    4 | void Test1::E::f()
// CHECK-5-NEXT:    5 | void Test1::E::h()
// CHECK-5-NEXT:    6 | vbase_offset (40)
// CHECK-5-NEXT:    7 | offset_to_top (-16)
// CHECK-5-NEXT:    8 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::B, 16) vtable address --
// CHECK-5-NEXT:        -- (Test1::D, 16) vtable address --
// CHECK-5-NEXT:    9 | void Test1::E::f()
// CHECK-5-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-5-NEXT:   10 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-5-NEXT:   11 | vbase_offset (24)
// CHECK-5-NEXT:   12 | offset_to_top (-32)
// CHECK-5-NEXT:   13 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::C, 32) vtable address --
// CHECK-5-NEXT:   14 | void Test1::C::g()
// CHECK-5-NEXT:   15 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: -32 non-virtual]
// CHECK-5-NEXT:   16 | vcall_offset (-56)
// CHECK-5-NEXT:   17 | vcall_offset (-24)
// CHECK-5-NEXT:   18 | vcall_offset (-56)
// CHECK-5-NEXT:   19 | offset_to_top (-56)
// CHECK-5-NEXT:   20 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::A, 56) vtable address --
// CHECK-5-NEXT:   21 | void Test1::E::f()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-5-NEXT:   22 | void Test1::C::g()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-5-NEXT:   23 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct E : X, D {
  int ie;
  void f();
  void h ();
};
void E::f() { } 

}

namespace Test2 {

// From http://www.codesourcery.com/public/cxx-abi/abi.html#class-types.

struct A { virtual void f(); };
struct B : virtual public A { int i; };
struct C : virtual public A { int j; };

// CHECK-6:      Vtable for 'Test2::D' (11 entries).
// CHECK-6-NEXT:    0 | vbase_offset (0)
// CHECK-6-NEXT:    1 | vcall_offset (0)
// CHECK-6-NEXT:    2 | offset_to_top (0)
// CHECK-6-NEXT:    3 | Test2::D RTTI
// CHECK-6-NEXT:        -- (Test2::A, 0) vtable address --
// CHECK-6-NEXT:        -- (Test2::B, 0) vtable address --
// CHECK-6-NEXT:        -- (Test2::D, 0) vtable address --
// CHECK-6-NEXT:    4 | void Test2::A::f()
// CHECK-6-NEXT:    5 | void Test2::D::d()
// CHECK-6-NEXT:    6 | vbase_offset (-16)
// CHECK-6-NEXT:    7 | vcall_offset (-16)
// CHECK-6-NEXT:    8 | offset_to_top (-16)
// CHECK-6-NEXT:    9 | Test2::D RTTI
// CHECK-6-NEXT:        -- (Test2::C, 16) vtable address --
// CHECK-6-NEXT:   10 | [unused] void Test2::A::f()
struct D : public B, public C {
  virtual void d();
};
void D::d() { } 

}

namespace Test3 {

// From http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor

struct V1 {
  int v1;
  virtual void f();
};

struct V2 : virtual V1 {
  int v2;
  virtual void f();
};

// CHECK-7:      Vtable for 'Test3::C' (14 entries).
// CHECK-7-NEXT:    0 | vbase_offset (32)
// CHECK-7-NEXT:    1 | vbase_offset (16)
// CHECK-7-NEXT:    2 | offset_to_top (0)
// CHECK-7-NEXT:    3 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-7-NEXT:    4 | void Test3::C::f()
// CHECK-7-NEXT:    5 | vcall_offset (-16)
// CHECK-7-NEXT:    6 | offset_to_top (-16)
// CHECK-7-NEXT:    7 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::V1, 16) vtable address --
// CHECK-7-NEXT:    8 | void Test3::C::f()
// CHECK-7-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-7-NEXT:    9 | vcall_offset (-32)
// CHECK-7-NEXT:   10 | vbase_offset (-16)
// CHECK-7-NEXT:   11 | offset_to_top (-32)
// CHECK-7-NEXT:   12 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::V2, 32) vtable address --
// CHECK-7-NEXT:   13 | void Test3::C::f()
// CHECK-7-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-8:      Construction vtable for ('Test3::V2', 32) in 'Test3::C' (9 entries).
// CHECK-8-NEXT:    0 | vcall_offset (0)
// CHECK-8-NEXT:    1 | vbase_offset (-16)
// CHECK-8-NEXT:    2 | offset_to_top (0)
// CHECK-8-NEXT:    3 | Test3::V2 RTTI
// CHECK-8-NEXT:        -- (Test3::V2, 32) vtable address --
// CHECK-8-NEXT:    4 | void Test3::V2::f()
// CHECK-8-NEXT:    5 | vcall_offset (16)
// CHECK-8-NEXT:    6 | offset_to_top (16)
// CHECK-8-NEXT:    7 | Test3::V2 RTTI
// CHECK-8-NEXT:        -- (Test3::V1, 16) vtable address --
// CHECK-8-NEXT:    8 | void Test3::V2::f()
// CHECK-8-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct C : virtual V1, virtual V2 {
  int c;
  virtual void f();
};
void C::f() { }

struct B {
  int b;
};

// CHECK-9:      Vtable for 'Test3::D' (15 entries).
// CHECK-9-NEXT:    0 | vbase_offset (40)
// CHECK-9-NEXT:    1 | vbase_offset (24)
// CHECK-9-NEXT:    2 | offset_to_top (0)
// CHECK-9-NEXT:    3 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-9-NEXT:        -- (Test3::D, 0) vtable address --
// CHECK-9-NEXT:    4 | void Test3::C::f()
// CHECK-9-NEXT:    5 | void Test3::D::g()
// CHECK-9-NEXT:    6 | vcall_offset (-24)
// CHECK-9-NEXT:    7 | offset_to_top (-24)
// CHECK-9-NEXT:    8 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-9-NEXT:    9 | void Test3::C::f()
// CHECK-9-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-9-NEXT:   10 | vcall_offset (-40)
// CHECK-9-NEXT:   11 | vbase_offset (-16)
// CHECK-9-NEXT:   12 | offset_to_top (-40)
// CHECK-9-NEXT:   13 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-9-NEXT:   14 | void Test3::C::f()
// CHECK-9-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-10:      Construction vtable for ('Test3::C', 0) in 'Test3::D' (14 entries).
// CHECK-10-NEXT:    0 | vbase_offset (40)
// CHECK-10-NEXT:    1 | vbase_offset (24)
// CHECK-10-NEXT:    2 | offset_to_top (0)
// CHECK-10-NEXT:    3 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-10-NEXT:    4 | void Test3::C::f()
// CHECK-10-NEXT:    5 | vcall_offset (-24)
// CHECK-10-NEXT:    6 | offset_to_top (-24)
// CHECK-10-NEXT:    7 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-10-NEXT:    8 | void Test3::C::f()
// CHECK-10-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-10-NEXT:    9 | vcall_offset (-40)
// CHECK-10-NEXT:   10 | vbase_offset (-16)
// CHECK-10-NEXT:   11 | offset_to_top (-40)
// CHECK-10-NEXT:   12 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-10-NEXT:   13 | void Test3::C::f()
// CHECK-10-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-11:      Construction vtable for ('Test3::V2', 40) in 'Test3::D' (9 entries).
// CHECK-11-NEXT:    0 | vcall_offset (0)
// CHECK-11-NEXT:    1 | vbase_offset (-16)
// CHECK-11-NEXT:    2 | offset_to_top (0)
// CHECK-11-NEXT:    3 | Test3::V2 RTTI
// CHECK-11-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-11-NEXT:    4 | void Test3::V2::f()
// CHECK-11-NEXT:    5 | vcall_offset (16)
// CHECK-11-NEXT:    6 | offset_to_top (16)
// CHECK-11-NEXT:    7 | Test3::V2 RTTI
// CHECK-11-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-11-NEXT:    8 | void Test3::V2::f()
// CHECK-11-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct D : B, C {
  int d;
  virtual void g();
};
void D::g() { }

}
@


1.1.1.2.4.1
log
@file vtable-layout-abi-examples.cpp was added on branch yamt-pagecache on 2014-05-22 16:18:57 +0000
@
text
@d1 322
@


1.1.1.2.4.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@a0 322
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>/dev/null
// RUN: FileCheck --check-prefix=CHECK-1 %s < %t
// RUN: FileCheck --check-prefix=CHECK-2 %s < %t
// RUN: FileCheck --check-prefix=CHECK-3 %s < %t
// RUN: FileCheck --check-prefix=CHECK-4 %s < %t
// RUN: FileCheck --check-prefix=CHECK-5 %s < %t
// RUN: FileCheck --check-prefix=CHECK-6 %s < %t
// RUN: FileCheck --check-prefix=CHECK-7 %s < %t
// RUN: FileCheck --check-prefix=CHECK-8 %s < %t
// RUN: FileCheck --check-prefix=CHECK-9 %s < %t
// RUN: FileCheck --check-prefix=CHECK-10 %s < %t
// RUN: FileCheck --check-prefix=CHECK-11 %s < %t

/// Examples from the Itanium C++ ABI specification.
/// http://www.codesourcery.com/public/cxx-abi/

namespace Test1 {
  
// This is from http://www.codesourcery.com/public/cxx-abi/cxx-vtable-ex.html

// CHECK-1:      Vtable for 'Test1::A' (5 entries).
// CHECK-1-NEXT:    0 | offset_to_top (0)
// CHECK-1-NEXT:    1 | Test1::A RTTI
// CHECK-1-NEXT:        -- (Test1::A, 0) vtable address --
// CHECK-1-NEXT:    2 | void Test1::A::f()
// CHECK-1-NEXT:    3 | void Test1::A::g()
// CHECK-1-NEXT:    4 | void Test1::A::h()
struct A {
  virtual void f ();
  virtual void g ();
  virtual void h ();
  int ia;
};
void A::f() {}

// CHECK-2:      Vtable for 'Test1::B' (13 entries).
// CHECK-2-NEXT:    0 | vbase_offset (16)
// CHECK-2-NEXT:    1 | offset_to_top (0)
// CHECK-2-NEXT:    2 | Test1::B RTTI
// CHECK-2-NEXT:        -- (Test1::B, 0) vtable address --
// CHECK-2-NEXT:    3 | void Test1::B::f()
// CHECK-2-NEXT:    4 | void Test1::B::h()
// CHECK-2-NEXT:    5 | vcall_offset (-16)
// CHECK-2-NEXT:    6 | vcall_offset (0)
// CHECK-2-NEXT:    7 | vcall_offset (-16)
// CHECK-2-NEXT:    8 | offset_to_top (-16)
// CHECK-2-NEXT:    9 | Test1::B RTTI
// CHECK-2-NEXT:        -- (Test1::A, 16) vtable address --
// CHECK-2-NEXT:   10 | void Test1::B::f()
// CHECK-2-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-2-NEXT:   11 | void Test1::A::g()
// CHECK-2-NEXT:   12 | void Test1::B::h()
// CHECK-2-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct B: public virtual A {
  void f ();
  void h ();
  int ib;
};
void B::f() {}

// CHECK-3:      Vtable for 'Test1::C' (13 entries).
// CHECK-3-NEXT:    0 | vbase_offset (16)
// CHECK-3-NEXT:    1 | offset_to_top (0)
// CHECK-3-NEXT:    2 | Test1::C RTTI
// CHECK-3-NEXT:        -- (Test1::C, 0) vtable address --
// CHECK-3-NEXT:    3 | void Test1::C::g()
// CHECK-3-NEXT:    4 | void Test1::C::h()
// CHECK-3-NEXT:    5 | vcall_offset (-16)
// CHECK-3-NEXT:    6 | vcall_offset (-16)
// CHECK-3-NEXT:    7 | vcall_offset (0)
// CHECK-3-NEXT:    8 | offset_to_top (-16)
// CHECK-3-NEXT:    9 | Test1::C RTTI
// CHECK-3-NEXT:        -- (Test1::A, 16) vtable address --
// CHECK-3-NEXT:   10 | void Test1::A::f()
// CHECK-3-NEXT:   11 | void Test1::C::g()
// CHECK-3-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-3-NEXT:   12 | void Test1::C::h()
// CHECK-3-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct C: public virtual A {
  void g ();
  void h ();
  int ic;
};
void C::g() {}

// CHECK-4:      Vtable for 'Test1::D' (18 entries).
// CHECK-4-NEXT:    0 | vbase_offset (32)
// CHECK-4-NEXT:    1 | offset_to_top (0)
// CHECK-4-NEXT:    2 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::B, 0) vtable address --
// CHECK-4-NEXT:        -- (Test1::D, 0) vtable address --
// CHECK-4-NEXT:    3 | void Test1::B::f()
// CHECK-4-NEXT:    4 | void Test1::D::h()
// CHECK-4-NEXT:    5 | vbase_offset (16)
// CHECK-4-NEXT:    6 | offset_to_top (-16)
// CHECK-4-NEXT:    7 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::C, 16) vtable address --
// CHECK-4-NEXT:    8 | void Test1::C::g()
// CHECK-4-NEXT:    9 | void Test1::D::h()
// CHECK-4-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-4-NEXT:   10 | vcall_offset (-32)
// CHECK-4-NEXT:   11 | vcall_offset (-16)
// CHECK-4-NEXT:   12 | vcall_offset (-32)
// CHECK-4-NEXT:   13 | offset_to_top (-32)
// CHECK-4-NEXT:   14 | Test1::D RTTI
// CHECK-4-NEXT:        -- (Test1::A, 32) vtable address --
// CHECK-4-NEXT:   15 | void Test1::B::f()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-4-NEXT:   16 | void Test1::C::g()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-4-NEXT:   17 | void Test1::D::h()
// CHECK-4-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct D: public B, public C {
  void h ();
  int id;
};
void D::h() { }

struct X {
  int ix;
  virtual void x();
};

// CHECK-5:      Vtable for 'Test1::E' (24 entries).
// CHECK-5-NEXT:    0 | vbase_offset (56)
// CHECK-5-NEXT:    1 | offset_to_top (0)
// CHECK-5-NEXT:    2 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::E, 0) vtable address --
// CHECK-5-NEXT:        -- (Test1::X, 0) vtable address --
// CHECK-5-NEXT:    3 | void Test1::X::x()
// CHECK-5-NEXT:    4 | void Test1::E::f()
// CHECK-5-NEXT:    5 | void Test1::E::h()
// CHECK-5-NEXT:    6 | vbase_offset (40)
// CHECK-5-NEXT:    7 | offset_to_top (-16)
// CHECK-5-NEXT:    8 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::B, 16) vtable address --
// CHECK-5-NEXT:        -- (Test1::D, 16) vtable address --
// CHECK-5-NEXT:    9 | void Test1::E::f()
// CHECK-5-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-5-NEXT:   10 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: -16 non-virtual]
// CHECK-5-NEXT:   11 | vbase_offset (24)
// CHECK-5-NEXT:   12 | offset_to_top (-32)
// CHECK-5-NEXT:   13 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::C, 32) vtable address --
// CHECK-5-NEXT:   14 | void Test1::C::g()
// CHECK-5-NEXT:   15 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: -32 non-virtual]
// CHECK-5-NEXT:   16 | vcall_offset (-56)
// CHECK-5-NEXT:   17 | vcall_offset (-24)
// CHECK-5-NEXT:   18 | vcall_offset (-56)
// CHECK-5-NEXT:   19 | offset_to_top (-56)
// CHECK-5-NEXT:   20 | Test1::E RTTI
// CHECK-5-NEXT:        -- (Test1::A, 56) vtable address --
// CHECK-5-NEXT:   21 | void Test1::E::f()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-5-NEXT:   22 | void Test1::C::g()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]
// CHECK-5-NEXT:   23 | void Test1::E::h()
// CHECK-5-NEXT:        [this adjustment: 0 non-virtual, -40 vcall offset offset]
struct E : X, D {
  int ie;
  void f();
  void h ();
};
void E::f() { } 

}

namespace Test2 {

// From http://www.codesourcery.com/public/cxx-abi/abi.html#class-types.

struct A { virtual void f(); };
struct B : virtual public A { int i; };
struct C : virtual public A { int j; };

// CHECK-6:      Vtable for 'Test2::D' (11 entries).
// CHECK-6-NEXT:    0 | vbase_offset (0)
// CHECK-6-NEXT:    1 | vcall_offset (0)
// CHECK-6-NEXT:    2 | offset_to_top (0)
// CHECK-6-NEXT:    3 | Test2::D RTTI
// CHECK-6-NEXT:        -- (Test2::A, 0) vtable address --
// CHECK-6-NEXT:        -- (Test2::B, 0) vtable address --
// CHECK-6-NEXT:        -- (Test2::D, 0) vtable address --
// CHECK-6-NEXT:    4 | void Test2::A::f()
// CHECK-6-NEXT:    5 | void Test2::D::d()
// CHECK-6-NEXT:    6 | vbase_offset (-16)
// CHECK-6-NEXT:    7 | vcall_offset (-16)
// CHECK-6-NEXT:    8 | offset_to_top (-16)
// CHECK-6-NEXT:    9 | Test2::D RTTI
// CHECK-6-NEXT:        -- (Test2::C, 16) vtable address --
// CHECK-6-NEXT:   10 | [unused] void Test2::A::f()
struct D : public B, public C {
  virtual void d();
};
void D::d() { } 

}

namespace Test3 {

// From http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor

struct V1 {
  int v1;
  virtual void f();
};

struct V2 : virtual V1 {
  int v2;
  virtual void f();
};

// CHECK-7:      Vtable for 'Test3::C' (14 entries).
// CHECK-7-NEXT:    0 | vbase_offset (32)
// CHECK-7-NEXT:    1 | vbase_offset (16)
// CHECK-7-NEXT:    2 | offset_to_top (0)
// CHECK-7-NEXT:    3 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-7-NEXT:    4 | void Test3::C::f()
// CHECK-7-NEXT:    5 | vcall_offset (-16)
// CHECK-7-NEXT:    6 | offset_to_top (-16)
// CHECK-7-NEXT:    7 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::V1, 16) vtable address --
// CHECK-7-NEXT:    8 | void Test3::C::f()
// CHECK-7-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-7-NEXT:    9 | vcall_offset (-32)
// CHECK-7-NEXT:   10 | vbase_offset (-16)
// CHECK-7-NEXT:   11 | offset_to_top (-32)
// CHECK-7-NEXT:   12 | Test3::C RTTI
// CHECK-7-NEXT:        -- (Test3::V2, 32) vtable address --
// CHECK-7-NEXT:   13 | void Test3::C::f()
// CHECK-7-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-8:      Construction vtable for ('Test3::V2', 32) in 'Test3::C' (9 entries).
// CHECK-8-NEXT:    0 | vcall_offset (0)
// CHECK-8-NEXT:    1 | vbase_offset (-16)
// CHECK-8-NEXT:    2 | offset_to_top (0)
// CHECK-8-NEXT:    3 | Test3::V2 RTTI
// CHECK-8-NEXT:        -- (Test3::V2, 32) vtable address --
// CHECK-8-NEXT:    4 | void Test3::V2::f()
// CHECK-8-NEXT:    5 | vcall_offset (16)
// CHECK-8-NEXT:    6 | offset_to_top (16)
// CHECK-8-NEXT:    7 | Test3::V2 RTTI
// CHECK-8-NEXT:        -- (Test3::V1, 16) vtable address --
// CHECK-8-NEXT:    8 | void Test3::V2::f()
// CHECK-8-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct C : virtual V1, virtual V2 {
  int c;
  virtual void f();
};
void C::f() { }

struct B {
  int b;
};

// CHECK-9:      Vtable for 'Test3::D' (15 entries).
// CHECK-9-NEXT:    0 | vbase_offset (40)
// CHECK-9-NEXT:    1 | vbase_offset (24)
// CHECK-9-NEXT:    2 | offset_to_top (0)
// CHECK-9-NEXT:    3 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-9-NEXT:        -- (Test3::D, 0) vtable address --
// CHECK-9-NEXT:    4 | void Test3::C::f()
// CHECK-9-NEXT:    5 | void Test3::D::g()
// CHECK-9-NEXT:    6 | vcall_offset (-24)
// CHECK-9-NEXT:    7 | offset_to_top (-24)
// CHECK-9-NEXT:    8 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-9-NEXT:    9 | void Test3::C::f()
// CHECK-9-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-9-NEXT:   10 | vcall_offset (-40)
// CHECK-9-NEXT:   11 | vbase_offset (-16)
// CHECK-9-NEXT:   12 | offset_to_top (-40)
// CHECK-9-NEXT:   13 | Test3::D RTTI
// CHECK-9-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-9-NEXT:   14 | void Test3::C::f()
// CHECK-9-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-10:      Construction vtable for ('Test3::C', 0) in 'Test3::D' (14 entries).
// CHECK-10-NEXT:    0 | vbase_offset (40)
// CHECK-10-NEXT:    1 | vbase_offset (24)
// CHECK-10-NEXT:    2 | offset_to_top (0)
// CHECK-10-NEXT:    3 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::C, 0) vtable address --
// CHECK-10-NEXT:    4 | void Test3::C::f()
// CHECK-10-NEXT:    5 | vcall_offset (-24)
// CHECK-10-NEXT:    6 | offset_to_top (-24)
// CHECK-10-NEXT:    7 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-10-NEXT:    8 | void Test3::C::f()
// CHECK-10-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
// CHECK-10-NEXT:    9 | vcall_offset (-40)
// CHECK-10-NEXT:   10 | vbase_offset (-16)
// CHECK-10-NEXT:   11 | offset_to_top (-40)
// CHECK-10-NEXT:   12 | Test3::C RTTI
// CHECK-10-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-10-NEXT:   13 | void Test3::C::f()
// CHECK-10-NEXT:        [this adjustment: 0 non-virtual, -32 vcall offset offset]

// CHECK-11:      Construction vtable for ('Test3::V2', 40) in 'Test3::D' (9 entries).
// CHECK-11-NEXT:    0 | vcall_offset (0)
// CHECK-11-NEXT:    1 | vbase_offset (-16)
// CHECK-11-NEXT:    2 | offset_to_top (0)
// CHECK-11-NEXT:    3 | Test3::V2 RTTI
// CHECK-11-NEXT:        -- (Test3::V2, 40) vtable address --
// CHECK-11-NEXT:    4 | void Test3::V2::f()
// CHECK-11-NEXT:    5 | vcall_offset (16)
// CHECK-11-NEXT:    6 | offset_to_top (16)
// CHECK-11-NEXT:    7 | Test3::V2 RTTI
// CHECK-11-NEXT:        -- (Test3::V1, 24) vtable address --
// CHECK-11-NEXT:    8 | void Test3::V2::f()
// CHECK-11-NEXT:        [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct D : B, C {
  int d;
  virtual void g();
};
void D::g() { }

}
@


