From: Paul Robinson Date: Tue, 20 Dec 2016 22:22:24 +0000 (+0000) Subject: Make two vtable tests tolerate C++11. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=768efe7b26a100e77ff5e809609d5a373c113076;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290205 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp index ca5384d6e0..4a47e3c9d2 100644 --- a/test/CodeGenCXX/vtable-layout.cpp +++ b/test/CodeGenCXX/vtable-layout.cpp @@ -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 {}; diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp index 0b556d10c3..2e37c95c63 100644 --- a/test/CodeGenCXX/vtable-linkage.cpp +++ b/test/CodeGenCXX/vtable-linkage.cpp @@ -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 struct E {