summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2013-10-06 15:31:37 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2013-10-06 15:31:37 +0000
commit20df98c0d002f7e91b54f1eb74f61615f2bc18c0 (patch)
tree4e5c5723897cd3def9a7d7d5302af58b7e95d49d /clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
parent78527050c28fcdb57c0d24a10b55ab43dc4e5412 (diff)
downloadbcm5719-llvm-20df98c0d002f7e91b54f1eb74f61615f2bc18c0.tar.gz
bcm5719-llvm-20df98c0d002f7e91b54f1eb74f61615f2bc18c0.zip
Fix PR17382 - properly group virtual method overloads in the vftable
llvm-svn: 192067
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp')
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp101
1 files changed, 101 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp b/clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
index 82e8f1c516c..4a0a76dbf2c 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
@@ -9,6 +9,11 @@
// RUN: FileCheck --check-prefix=CHECK-F %s < %t
// RUN: FileCheck --check-prefix=CHECK-G %s < %t
// RUN: FileCheck --check-prefix=CHECK-I %s < %t
+// RUN: FileCheck --check-prefix=CHECK-J %s < %t
+// RUN: FileCheck --check-prefix=CHECK-K %s < %t
+// RUN: FileCheck --check-prefix=CHECK-L %s < %t
+// RUN: FileCheck --check-prefix=CHECK-M %s < %t
+// RUN: FileCheck --check-prefix=CHECK-N %s < %t
struct A {
// CHECK-A: VFTable for 'A' (3 entries)
@@ -149,3 +154,99 @@ struct I : Empty {
};
I i;
+
+struct J {
+ // CHECK-J: VFTable for 'J' (6 entries)
+ // CHECK-J-NEXT: 0 | void J::foo(long)
+ // CHECK-J-NEXT: 1 | void J::foo(int)
+ // CHECK-J-NEXT: 2 | void J::foo(short)
+ // CHECK-J-NEXT: 3 | void J::bar(long)
+ // CHECK-J-NEXT: 4 | void J::bar(int)
+ // CHECK-J-NEXT: 5 | void J::bar(short)
+ virtual void foo(short);
+ virtual void bar(short);
+ virtual void foo(int);
+ virtual void bar(int);
+ virtual void foo(long);
+ virtual void bar(long);
+};
+
+J j;
+
+struct K : J {
+ // CHECK-K: VFTable for 'J' in 'K' (9 entries)
+ // CHECK-K-NEXT: 0 | void J::foo(long)
+ // CHECK-K-NEXT: 1 | void J::foo(int)
+ // CHECK-K-NEXT: 2 | void J::foo(short)
+ // CHECK-K-NEXT: 3 | void J::bar(long)
+ // CHECK-K-NEXT: 4 | void J::bar(int)
+ // CHECK-K-NEXT: 5 | void J::bar(short)
+ // CHECK-K-NEXT: 6 | void K::bar(double)
+ // CHECK-K-NEXT: 7 | void K::bar(float)
+ // CHECK-K-NEXT: 8 | void K::foo(float)
+ virtual void bar(float);
+ virtual void foo(float);
+ virtual void bar(double);
+};
+
+K k;
+
+struct L : J {
+ // CHECK-L: VFTable for 'J' in 'L' (9 entries)
+ // CHECK-L-NEXT: 0 | void J::foo(long)
+ // CHECK-L-NEXT: 1 | void L::foo(int)
+ // CHECK-L-NEXT: 2 | void J::foo(short)
+ // CHECK-L-NEXT: 3 | void J::bar(long)
+ // CHECK-L-NEXT: 4 | void J::bar(int)
+ // CHECK-L-NEXT: 5 | void J::bar(short)
+ // CHECK-L-NEXT: 6 | void L::foo(float)
+ // CHECK-L-NEXT: 7 | void L::bar(double)
+ // CHECK-L-NEXT: 8 | void L::bar(float)
+
+ // This case is interesting. Since the J::foo(int) override is the first method in
+ // the class, foo(float) precedes the bar(double) and bar(float) in the vftable.
+ virtual void foo(int);
+ virtual void bar(float);
+ virtual void foo(float);
+ virtual void bar(double);
+};
+
+L l;
+
+struct M : J {
+ // CHECK-M: VFTable for 'J' in 'M' (11 entries)
+ // CHECK-M-NEXT: 0 | void J::foo(long)
+ // CHECK-M-NEXT: 1 | void M::foo(int)
+ // CHECK-M-NEXT: 2 | void J::foo(short)
+ // CHECK-M-NEXT: 3 | void J::bar(long)
+ // CHECK-M-NEXT: 4 | void J::bar(int)
+ // CHECK-M-NEXT: 5 | void J::bar(short)
+ // CHECK-M-NEXT: 6 | void M::foo(float)
+ // CHECK-M-NEXT: 7 | void M::spam(long)
+ // CHECK-M-NEXT: 8 | void M::spam(int)
+ // CHECK-M-NEXT: 9 | void M::bar(double)
+ // CHECK-M-NEXT: 10 | void M::bar(float)
+
+ virtual void foo(int);
+ virtual void spam(int);
+ virtual void bar(float);
+ virtual void bar(double);
+ virtual void foo(float);
+ virtual void spam(long);
+};
+
+M m;
+
+struct N {
+ // CHECK-N: VFTable for 'N' (4 entries)
+ // CHECK-N-NEXT: 0 | void N::operator+(int)
+ // CHECK-N-NEXT: 1 | void N::operator+(short)
+ // CHECK-N-NEXT: 2 | void N::operator*(int)
+ // CHECK-N-NEXT: 3 | void N::operator*(short)
+ virtual void operator+(short);
+ virtual void operator*(short);
+ virtual void operator+(int);
+ virtual void operator*(int);
+};
+
+N n;
OpenPOWER on IntegriCloud