r290205 - Make two vtable tests tolerate C++11.
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 20 14:22:24 PST 2016
Author: probinson
Date: Tue Dec 20 16:22:24 2016
New Revision: 290205
URL: http://llvm.org/viewvc/llvm-project?rev=290205&view=rev
Log:
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
Modified:
cfe/trunk/test/CodeGenCXX/vtable-layout.cpp
cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
Modified: cfe/trunk/test/CodeGenCXX/vtable-layout.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-layout.cpp?rev=290205&r1=290204&r2=290205&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-layout.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-layout.cpp Tue Dec 20 16:22:24 2016
@@ -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 {};
Modified: cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp?rev=290205&r1=290204&r2=290205&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp Tue Dec 20 16:22:24 2016
@@ -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 {
More information about the cfe-commits
mailing list