summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBob Haarman <llvm@inglorion.net>2016-10-25 22:11:52 +0000
committerBob Haarman <llvm@inglorion.net>2016-10-25 22:11:52 +0000
commit26a87bd0306cd9ac6754bf6039f79bd9c777f842 (patch)
tree3d1760068de99823484db35d3cf539746b3fe98e /llvm/lib
parentde86241a097414640d1d410e68ac3287c24d9810 (diff)
downloadbcm5719-llvm-26a87bd0306cd9ac6754bf6039f79bd9c777f842.tar.gz
bcm5719-llvm-26a87bd0306cd9ac6754bf6039f79bd9c777f842.zip
[codeview] support emitting indirect virtual base class information
Summary: Fixes PR28281. MSVC lists indirect virtual base classes in the field list of a class, using LF_IVBCLASS records. This change makes LLVM emit such records when processing DW_TAG_inheritance tags with the DIFlagVirtual and (newly introduced) DIFlagIndirect tags. Reviewers: rnk, ruiu, zturner Differential Revision: https://reviews.llvm.org/D25578 llvm-svn: 285130
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp5
-rw-r--r--llvm/lib/DebugInfo/CodeView/TypeRecord.cpp4
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp9
3 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index a305e3d3ab9..a1fd0dc8869 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -1786,8 +1786,11 @@ CodeViewDebug::lowerRecordFieldList(const DICompositeType *Ty) {
unsigned VBPtrOffset = 0;
// FIXME: Despite the accessor name, the offset is really in bytes.
unsigned VBTableIndex = I->getOffsetInBits() / 4;
+ auto RecordKind = (I->getFlags() & DINode::FlagIndirectVirtualBase) == DINode::FlagIndirectVirtualBase
+ ? TypeRecordKind::IndirectVirtualBaseClass
+ : TypeRecordKind::VirtualBaseClass;
Fields.writeMemberType(VirtualBaseClassRecord(
- translateAccessFlags(Ty->getTag(), I->getFlags()),
+ RecordKind, translateAccessFlags(Ty->getTag(), I->getFlags()),
getTypeIndex(I->getBaseType()), getVBPTypeIndex(), VBPtrOffset,
VBTableIndex));
} else {
diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
index a7a1bb9228c..7a2dc8fa803 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
@@ -382,8 +382,8 @@ VirtualBaseClassRecord::deserialize(TypeRecordKind Kind,
uint64_t Offset;
uint64_t Index;
CV_DESERIALIZE(Reader, L, CV_NUMERIC_FIELD(Offset), CV_NUMERIC_FIELD(Index));
- return VirtualBaseClassRecord(L->Attrs.getAccess(), L->BaseType, L->VBPtrType,
- Offset, Index);
+ return VirtualBaseClassRecord(Kind, L->Attrs.getAccess(), L->BaseType,
+ L->VBPtrType, Offset, Index);
}
Expected<ListContinuationRecord>
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 19f02cd38d6..17c828a5d26 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -84,8 +84,9 @@ StringRef DINode::getFlagString(DIFlags Flag) {
DINode::DIFlags DINode::splitFlags(DIFlags Flags,
SmallVectorImpl<DIFlags> &SplitFlags) {
- // Accessibility and member pointer flags need to be specially handled, since
- // they're packed together.
+ // Flags that are packed together need to be specially handled, so
+ // that, for example, we emit "DIFlagPublic" and not
+ // "DIFlagPrivate | DIFlagProtected".
if (DIFlags A = Flags & FlagAccessibility) {
if (A == FlagPrivate)
SplitFlags.push_back(FlagPrivate);
@@ -104,6 +105,10 @@ DINode::DIFlags DINode::splitFlags(DIFlags Flags,
SplitFlags.push_back(FlagVirtualInheritance);
Flags &= ~R;
}
+ if ((Flags & FlagIndirectVirtualBase) == FlagIndirectVirtualBase) {
+ Flags &= ~FlagIndirectVirtualBase;
+ SplitFlags.push_back(FlagIndirectVirtualBase);
+ }
#define HANDLE_DI_FLAG(ID, NAME) \
if (DIFlags Bit = Flags & Flag##NAME) { \
OpenPOWER on IntegriCloud