vtable-layout.cpp revision 848fa64143fbe5ae62a601ad61277f741e54dfab
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts 2>&1 | FileCheck %s 2namespace Test1 { 3 4// CHECK: Vtable for 'Test1::A' (3 entries). 5// CHECK-NEXT: 0 | offset_to_top (0) 6// CHECK-NEXT: 1 | Test1::A RTTI 7// CHECK-NEXT: -- (Test1::A, 0) vtable address -- 8// CHECK-NEXT: 2 | void Test1::A::f() 9struct A { 10 virtual void f(); 11}; 12 13void A::f() { } 14} 15 16namespace Test2 { 17 18// This is a smoke test of the vtable dumper. 19// CHECK: Vtable for 'Test2::A' (8 entries). 20// CHECK-NEXT: 0 | offset_to_top (0) 21// CHECK-NEXT: 1 | Test2::A RTTI 22// CHECK-NEXT: -- (Test2::A, 0) vtable address -- 23// CHECK-NEXT: 2 | void Test2::A::f() 24// CHECK-NEXT: 3 | void Test2::A::f() const 25// CHECK-NEXT: 4 | Test2::A *Test2::A::g(int) 26// CHECK-NEXT: 5 | Test2::A::~A() [complete] 27// CHECK-NEXT: 6 | Test2::A::~A() [deleting] 28// CHECK-NEXT: 7 | void Test2::A::h() 29struct A { 30 virtual void f(); 31 virtual void f() const; 32 33 virtual A* g(int a); 34 virtual ~A(); 35 virtual void h(); 36}; 37 38void A::f() { } 39 40} 41