forked from OSchip/llvm-project
[codeview] Add support for new types and symbols.
This patch adds support for: S_EXPORT LF_BITFIELD With this patch, I have run through a couple of gigabytes of PDB files and cannot find a type or symbol that we do not understand. llvm-svn: 270637
This commit is contained in:
parent
9f054d424f
commit
172d59c105
|
@ -58,7 +58,7 @@ public:
|
|||
DerivedThis->visitTypeBegin(Record.Type, RecordData);
|
||||
switch (Record.Type) {
|
||||
default:
|
||||
DerivedThis->visitUnknownType(Record.Type);
|
||||
DerivedThis->visitUnknownType(Record.Type, RecordData);
|
||||
break;
|
||||
case LF_FIELDLIST:
|
||||
DerivedThis->visitFieldList(Record.Type, LeafData);
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
}
|
||||
|
||||
/// Action to take on unknown types. By default, they are ignored.
|
||||
void visitUnknownType(TypeLeafKind Leaf) {}
|
||||
void visitUnknownType(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData) {}
|
||||
|
||||
/// Paired begin/end actions for all types. Receives all record data,
|
||||
/// including the fixed-length record prefix.
|
||||
|
|
|
@ -23,7 +23,6 @@ enum class TypeRecordKind : uint16_t {
|
|||
#include "TypeRecords.def"
|
||||
// FIXME: Add serialization support
|
||||
FieldList = 0x1203,
|
||||
BitField = 0x1205,
|
||||
};
|
||||
|
||||
/// Duplicate copy of the above enum, but using the official CV names. Useful
|
||||
|
|
|
@ -705,17 +705,36 @@ private:
|
|||
TypeIndex UnderlyingType;
|
||||
};
|
||||
|
||||
// LF_BITFIELD
|
||||
class BitFieldRecord : public TypeRecord {
|
||||
public:
|
||||
BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset)
|
||||
: TypeRecord(TypeRecordKind::BitField), Type(Type), BitSize(BitSize),
|
||||
BitOffset(BitOffset) {}
|
||||
|
||||
/// Rewrite member type indices with IndexMap. Returns false if a type index
|
||||
/// is not in the map.
|
||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||
|
||||
static ErrorOr<BitFieldRecord> deserialize(TypeRecordKind Kind,
|
||||
ArrayRef<uint8_t> &Data) {
|
||||
const Layout *L = nullptr;
|
||||
CV_DESERIALIZE(Data, L);
|
||||
|
||||
return BitFieldRecord(L->Type, L->BitSize, L->BitOffset);
|
||||
}
|
||||
|
||||
TypeIndex getType() const { return Type; }
|
||||
uint8_t getBitOffset() const { return BitOffset; }
|
||||
uint8_t getBitSize() const { return BitSize; }
|
||||
|
||||
private:
|
||||
struct Layout {
|
||||
TypeIndex Type;
|
||||
uint8_t BitSize;
|
||||
uint8_t BitOffset;
|
||||
};
|
||||
|
||||
TypeIndex Type;
|
||||
uint8_t BitSize;
|
||||
uint8_t BitOffset;
|
||||
|
|
|
@ -53,6 +53,8 @@ TYPE_RECORD(LF_TYPESERVER2, 0x1515, TypeServer2)
|
|||
TYPE_RECORD(LF_VFTABLE, 0x151d, VFTable)
|
||||
TYPE_RECORD(LF_VTSHAPE, 0x000a, VFTableShape)
|
||||
|
||||
TYPE_RECORD(LF_BITFIELD, 0x1205, BitField)
|
||||
|
||||
// Member type records. These are generally not length prefixed, and appear
|
||||
// inside of a field list record.
|
||||
MEMBER_RECORD(LF_BCLASS, 0x1400, BaseClass)
|
||||
|
@ -156,7 +158,6 @@ CV_TYPE(LF_SKIP, 0x1200)
|
|||
CV_TYPE(LF_DEFARG_ST, 0x1202)
|
||||
CV_TYPE(LF_FIELDLIST, 0x1203)
|
||||
CV_TYPE(LF_DERIVED, 0x1204)
|
||||
CV_TYPE(LF_BITFIELD, 0x1205)
|
||||
CV_TYPE(LF_DIMCONU, 0x1207)
|
||||
CV_TYPE(LF_DIMCONLU, 0x1208)
|
||||
CV_TYPE(LF_DIMVARU, 0x1209)
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
#include "llvm/DebugInfo/CodeView/TypeRecords.def"
|
||||
|
||||
void visitUnknownMember(TypeLeafKind Leaf);
|
||||
void visitUnknownType(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData);
|
||||
|
||||
void visitTypeBegin(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData);
|
||||
void visitTypeEnd(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData);
|
||||
|
@ -493,6 +494,13 @@ void CVTypeDumperImpl::visitModifier(TypeLeafKind Leaf, ModifierRecord &Mod) {
|
|||
Name = CVTD.saveName(TypeName);
|
||||
}
|
||||
|
||||
void CVTypeDumperImpl::visitBitField(TypeLeafKind Leaf,
|
||||
BitFieldRecord &BitField) {
|
||||
printTypeIndex("Type", BitField.getType());
|
||||
W.printNumber("BitSize", BitField.getBitSize());
|
||||
W.printNumber("BitOffset", BitField.getBitOffset());
|
||||
}
|
||||
|
||||
void CVTypeDumperImpl::visitVFTableShape(TypeLeafKind Leaf,
|
||||
VFTableShapeRecord &Shape) {
|
||||
W.printNumber("VFEntryCount", Shape.getEntryCount());
|
||||
|
@ -538,6 +546,13 @@ void CVTypeDumperImpl::visitUnknownMember(TypeLeafKind Leaf) {
|
|||
W.printHex("UnknownMember", unsigned(Leaf));
|
||||
}
|
||||
|
||||
void CVTypeDumperImpl::visitUnknownType(TypeLeafKind Leaf,
|
||||
ArrayRef<uint8_t> RecordData) {
|
||||
DictScope S(W, "UnknownType");
|
||||
W.printEnum("Kind", uint16_t(Leaf), makeArrayRef(LeafTypeNames));
|
||||
W.printNumber("Length", uint32_t(RecordData.size()));
|
||||
}
|
||||
|
||||
void CVTypeDumperImpl::visitNestedType(TypeLeafKind Leaf,
|
||||
NestedTypeRecord &Nested) {
|
||||
DictScope S(W, "NestedType");
|
||||
|
|
|
@ -105,6 +105,10 @@ bool EnumRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) {
|
|||
return Success;
|
||||
}
|
||||
|
||||
bool BitFieldRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) {
|
||||
return remapIndex(IndexMap, Type);
|
||||
}
|
||||
|
||||
bool VFTableShapeRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue