r192616 - Correctly check for distructors when realizing vtordisps
Warren Hunt
whunt at google.com
Mon Oct 14 13:14:09 PDT 2013
Author: whunt
Date: Mon Oct 14 15:14:09 2013
New Revision: 192616
URL: http://llvm.org/viewvc/llvm-project?rev=192616&view=rev
Log:
Correctly check for distructors when realizing vtordisps
This patch fixes the distructor test when checking for vtordisp requirements in
microsoft record layout. A test case is also included.
Addresses:
http://llvm.org/bugs/show_bug.cgi?id=16406#c7
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
cfe/trunk/test/Layout/ms-x86-vtordisp.cpp
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=192616&r1=192615&r2=192616&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Mon Oct 14 15:14:09 2013
@@ -2989,7 +2989,7 @@ MicrosoftRecordLayoutBuilder::computeVto
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
e = RD->method_end();
i != e; ++i)
- if ((*i)->isVirtual() && (*i) != RD->getDestructor())
+ if ((*i)->isVirtual() && !isa<CXXDestructorDecl>(*i))
Work.insert(*i);
while (!Work.empty()) {
const CXXMethodDecl *MD = *Work.begin();
Modified: cfe/trunk/test/Layout/ms-x86-vtordisp.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Layout/ms-x86-vtordisp.cpp?rev=192616&r1=192615&r2=192616&view=diff
==============================================================================
--- cfe/trunk/test/Layout/ms-x86-vtordisp.cpp (original)
+++ cfe/trunk/test/Layout/ms-x86-vtordisp.cpp Mon Oct 14 15:14:09 2013
@@ -91,7 +91,24 @@ struct __declspec(align(32)) D : virtual
// CHECK: | [sizeof=96, align=32
// CHECK: | nvsize=12, nvalign=4]
+struct AT {
+ virtual ~AT(){}
+};
+struct CT : virtual AT {
+ virtual ~CT();
+};
+CT::~CT(){}
+
+// CHECK: *** Dumping AST Record Layout
+// CHECK: 0 | struct CT
+// CHECK: 0 | (CT vbtable pointer)
+// CHECK: 4 | struct AT (virtual base)
+// CHECK: 4 | (AT vftable pointer)
+// CHECK: | [sizeof=8, align=4
+// CHECK: | nvsize=4, nvalign=4]
+
int a[
sizeof(A)+
sizeof(C)+
-sizeof(D)];
+sizeof(D)+
+sizeof(CT)];
More information about the cfe-commits
mailing list