diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-02-19 22:06:10 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-02-19 22:06:10 +0000 |
commit | 153fe11633e48f661da0e18d6979e6db04d9e0b9 (patch) | |
tree | 2fe305760573cb42be87c40c254b564bd392d20c /test | |
parent | 0fcf59c5a539f20b9e5e5230548de3dcc25cc8e0 (diff) | |
download | clang-153fe11633e48f661da0e18d6979e6db04d9e0b9.tar.gz |
MS ABI: Let non-virtual method overloads participate in vftable ordering
In the Microsoft ABI, the vftable is laid out as if all methods in every
overload set were declared in reverse order of declaration at the point
of declaration of the first overload in the set.
Previously we only considered virtual methods in an overload set, but
MSVC includes non-virtual methods for ordering purposes.
Fixes PR18902.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp index 428d9ee7da..088ed17ee6 100644 --- a/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp +++ b/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp @@ -15,6 +15,8 @@ // RUN: FileCheck --check-prefix=CHECK-M %s < %t // RUN: FileCheck --check-prefix=CHECK-N %s < %t // RUN: FileCheck --check-prefix=CHECK-O %s < %t +// RUN: FileCheck --check-prefix=CHECK-Q %s < %t +// RUN: FileCheck --check-prefix=CHECK-R %s < %t struct A { // CHECK-A: VFTable for 'A' (3 entries) @@ -260,3 +262,28 @@ P p; // CHECK-O: VFTable for 'O' (1 entries) // CHECK-O-NEXT: 0 | A *O::f() + +struct Q { + // CHECK-Q: VFTable for 'Q' (2 entries) + // CHECK-Q-NEXT: 0 | void Q::foo(int) + // CHECK-Q-NEXT: 1 | void Q::bar(int) + void foo(short); + void bar(short); + virtual void bar(int); + virtual void foo(int); +}; + +Q q; + +// Inherited non-virtual overloads don't participate in the ordering. +struct R : Q { + // CHECK-R: VFTable for 'Q' in 'R' (4 entries) + // CHECK-R-NEXT: 0 | void Q::foo(int) + // CHECK-R-NEXT: 1 | void Q::bar(int) + // CHECK-R-NEXT: 2 | void R::bar(long) + // CHECK-R-NEXT: 3 | void R::foo(long) + virtual void bar(long); + virtual void foo(long); +}; + +R r; |