[PATCH] D27994: Make two vtable tests tolerate C++11

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 20 14:32:57 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL290205: Make two vtable tests tolerate C++11. (authored by probinson).

Changed prior to commit:
  https://reviews.llvm.org/D27994?vs=82126&id=82156#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27994

Files:
  cfe/trunk/test/CodeGenCXX/vtable-layout.cpp
  cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp


Index: cfe/trunk/test/CodeGenCXX/vtable-layout.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-layout.cpp
+++ cfe/trunk/test/CodeGenCXX/vtable-layout.cpp
@@ -1919,6 +1919,8 @@
     virtual int i(int);
     virtual int i();
   };
+  // Force C's vtable to be generated.
+  int C::f() { return 1; }
 
   class D : C {};
 
Index: cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
+++ cfe/trunk/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 @@
 
 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27994.82156.patch
Type: text/x-patch
Size: 1316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161220/ba4aee7b/attachment.bin>


More information about the cfe-commits mailing list