From f037bd1e7c5bcd905c1a5678ddc671cd012ec4d9 Mon Sep 17 00:00:00 2001 From: Warren Hunt Date: Thu, 19 Dec 2013 00:43:59 +0000 Subject: [ms-abi] Update Alignment for VtorDisps The alignment impact of the virtual bases apperas to be applied in order, rather than up front. This patch adds the new behavior and provides a test case. llvm-svn: 197639 --- clang/lib/AST/RecordLayoutBuilder.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'clang/lib/AST/RecordLayoutBuilder.cpp') diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index d81fb00466f..74010ce7aa0 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -2525,14 +2525,6 @@ void MicrosoftRecordLayoutBuilder::layoutVirtualBases(const CXXRecordDecl *RD) { if (!HasVBPtr) return; - // Update the alignment - for (CXXRecordDecl::base_class_const_iterator i = RD->vbases_begin(), - e = RD->vbases_end(); - i != e; ++i) { - const CXXRecordDecl *BaseDecl = i->getType()->getAsCXXRecordDecl(); - const ASTRecordLayout &Layout = Context.getASTRecordLayout(BaseDecl); - updateAlignment(getBaseAlignment(Layout)); - } PreviousBaseLayout = 0; llvm::SmallPtrSet HasVtordisp = @@ -2569,6 +2561,8 @@ void MicrosoftRecordLayoutBuilder::layoutVirtualBase(const CXXRecordDecl *RD, // Insert the base here. Size = Size.RoundUpToAlignment(getBaseAlignment(Layout)); + // Update the alignment + updateAlignment(getBaseAlignment(Layout)); VBases.insert( std::make_pair(RD, ASTRecordLayout::VBaseInfo(Size, HasVtordisp))); Size += Layout.getNonVirtualSize(); -- cgit v1.2.3