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 | 6701de2abeb9a18fcd54d562d911e3818f2d193c (patch) | |
tree | dc719daaa7749e1a712bcdd95715b44b71f7d627 /clang/lib/AST/VTableBuilder.cpp | |
parent | c688dafe3100397ac4cdad20b0960c9ae1ede62b (diff) | |
download | bcm5719-llvm-6701de2abeb9a18fcd54d562d911e3818f2d193c.tar.gz bcm5719-llvm-6701de2abeb9a18fcd54d562d911e3818f2d193c.zip |
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.
llvm-svn: 201722
Diffstat (limited to 'clang/lib/AST/VTableBuilder.cpp')
-rw-r--r-- | clang/lib/AST/VTableBuilder.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 30f95d0f25b..e0e30a122a8 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -2789,7 +2789,7 @@ static void GroupNewVirtualOverloads( // Put the virtual methods into VirtualMethods in the proper order: // 1) Group overloads by declaration name. New groups are added to the // vftable in the order of their first declarations in this class - // (including overrides). + // (including overrides and non-virtual methods). // 2) In each group, new overloads appear in the reverse order of declaration. typedef SmallVector<const CXXMethodDecl *, 1> MethodGroup; SmallVector<MethodGroup, 10> Groups; @@ -2798,16 +2798,14 @@ static void GroupNewVirtualOverloads( for (CXXRecordDecl::method_iterator I = RD->method_begin(), E = RD->method_end(); I != E; ++I) { const CXXMethodDecl *MD = *I; - if (!MD->isVirtual()) - continue; VisitedGroupIndicesTy::iterator J; bool Inserted; llvm::tie(J, Inserted) = VisitedGroupIndices.insert( std::make_pair(MD->getDeclName(), Groups.size())); if (Inserted) - Groups.push_back(MethodGroup(1, MD)); - else + Groups.push_back(MethodGroup()); + if (I->isVirtual()) Groups[J->second].push_back(MD); } |