Make two vtable tests tolerate C++11.

In C++11 we don't emit vtables as eagerly as we do for C++03, so
fiddle the tests to emit them when the test expects them.

Differential Revision: http://reviews.llvm.org/D27994

llvm-svn: 290205
This commit is contained in:
Paul Robinson 2016-12-20 22:22:24 +00:00
parent ffc4aef542
commit e45f433413
2 changed files with 11 additions and 0 deletions

View File

@ -1919,6 +1919,8 @@ namespace Test40 {
virtual int i(int);
virtual int i();
};
// Force C's vtable to be generated.
int C::f() { return 1; }
class D : C {};

View File

@ -1,6 +1,10 @@
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux -emit-llvm -o %t
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux -emit-llvm -std=c++03 -o %t.03
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux -emit-llvm -std=c++11 -o %t.11
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -disable-llvm-optzns -O3 -emit-llvm -o %t.opt
// RUN: FileCheck %s < %t
// RUN: FileCheck %s < %t.03
// RUN: FileCheck %s < %t.11
// RUN: FileCheck --check-prefix=CHECK-OPT %s < %t.opt
namespace {
@ -33,6 +37,11 @@ void D::f() { }
static struct : D { } e;
// Force 'e' to be constructed and therefore have a vtable defined.
void use_e() {
e.f();
}
// The destructor is the key function.
template<typename T>
struct E {