diff options
author | Warren Hunt <whunt@google.com> | 2014-01-13 19:55:52 +0000 |
---|---|---|
committer | Warren Hunt <whunt@google.com> | 2014-01-13 19:55:52 +0000 |
commit | badf9e0f84a57e825ce1214a3a3f4bd10d867ff2 (patch) | |
tree | 8182e3df49e9b68ebb6cf82c91aa1be8e88f922e /clang/lib | |
parent | 50501fbe38305b0753d6b8f853ab202bba2152df (diff) | |
download | bcm5719-llvm-badf9e0f84a57e825ce1214a3a3f4bd10d867ff2.tar.gz bcm5719-llvm-badf9e0f84a57e825ce1214a3a3f4bd10d867ff2.zip |
[ms-abi] Leading VFPtrs don't suppress the leading zero sized flag
The MS-ABI tracks a bit that asserts that the first sub-object is zero
sized. This bit is used to add padding between objects if there's the
potential for zero sized objects to alias. The bit is still true even
if the zero sized base is lead by a VFPtr. This patch makes clang mimic
that behavior.
llvm-svn: 199132
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/RecordLayoutBuilder.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 885d4ff5fb6..e9289a0f055 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -2302,8 +2302,10 @@ MicrosoftRecordLayoutBuilder::layoutNonVirtualBases(const CXXRecordDecl *RD) { if (!BaseLayout.hasExtendableVFPtr()) continue; // If we don't have a primary base, this one qualifies. - if (!PrimaryBase) + if (!PrimaryBase) { PrimaryBase = BaseDecl; + LeadsWithZeroSizedBase = BaseLayout.leadsWithZeroSizedBase(); + } // Lay out the base. layoutNonVirtualBase(BaseDecl, BaseLayout, PreviousBaseLayout); } |