diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-06-23 20:34:18 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-06-23 20:34:18 +0000 |
commit | 08ef2ba113d225db7348b7541a15f29c740b823c (patch) | |
tree | a67d71a4dba89186e496fa37492bb936d7e784b1 /clang/lib/AST/ASTContext.cpp | |
parent | e44dd6dbd06814e0d8d6b1497fb681c00fe8f2dc (diff) | |
download | bcm5719-llvm-08ef2ba113d225db7348b7541a15f29c740b823c.tar.gz bcm5719-llvm-08ef2ba113d225db7348b7541a15f29c740b823c.zip |
[MS ABI] Account for the virtual inheritance quirk when mangling
Virtual inheritance member pointers are always relative to the vbindex,
even when the member pointer doesn't point into a virtual base. This is
corrected by adjusting the non-virtual offset backwards from the vbptr
back to the top of the most derived class. While we performed this
adjustment when manifesting member pointers as constants or when
performing conversions, we didn't perform the adjustment when mangling
them.
llvm-svn: 240453
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 049eebd82b6..e88ea946e72 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1866,6 +1866,16 @@ CharUnits ASTContext::getAlignOfGlobalVarInChars(QualType T) const { return toCharUnitsFromBits(getAlignOfGlobalVar(T)); } +CharUnits ASTContext::getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const { + CharUnits Offset = CharUnits::Zero(); + const ASTRecordLayout *Layout = &getASTRecordLayout(RD); + while (const CXXRecordDecl *Base = Layout->getBaseSharingVBPtr()) { + Offset += Layout->getBaseClassOffset(Base); + Layout = &getASTRecordLayout(Base); + } + return Offset; +} + /// DeepCollectObjCIvars - /// This routine first collects all declared, but not synthesized, ivars in /// super class and then collects all ivars, including those synthesized for |