From f5fc72eea9b30da1fc0c39ee8487109b7238a309 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Tue, 4 Aug 2009 20:37:29 +0000 Subject: [PATCH] Test cases for some recent work. llvm-svn: 78100 --- clang/test/CodeGenCXX/virt.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/clang/test/CodeGenCXX/virt.cpp b/clang/test/CodeGenCXX/virt.cpp index a07d8e011f78..fdca3f4a15b1 100644 --- a/clang/test/CodeGenCXX/virt.cpp +++ b/clang/test/CodeGenCXX/virt.cpp @@ -1,8 +1,30 @@ -// RUN: clang-cc %s -emit-llvm -o - -std=c++0x +// RUN: clang-cc -triple x86_64-apple-darwin -frtti=0 -std=c++0x -S %s -o %t-64.s && +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && +// RUN: clang-cc -triple i386-apple-darwin -frtti=0 -std=c++0x -S %s -o %t-32.s && +// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s && +// RUN: true class A { public: - virtual void foo(); -}; + virtual void foo1(); + virtual void foo2(); + A() { } +} *a; static_assert (sizeof (A) == (sizeof(void *)), "vtable pointer layout"); + +int main() { + A a; +} + +// CHECK-LP64: __ZTV1A: +// CHECK-LP64: .space 8 +// CHECK-LP64: .space 8 +// CHECK-LP64: .quad __ZN1A4foo1Ev +// CHECK-LP64: .quad __ZN1A4foo2Ev + +// CHECK-LP32: __ZTV1A: +// CHECK-LP32: .space 4 +// CHECK-LP32: .space 4 +// CHECK-LP32: .long __ZN1A4foo1Ev +// CHECK-LP32: .long __ZN1A4foo2Ev