Add CodeViewRecordIO for reading and writing.
Using a pattern similar to that of YamlIO, this allows
us to have a single codepath for translating codeview
records to and from serialized byte streams. The
current patch only hooks this up to the reading of
CodeView type records. A subsequent patch will hook
it up for writing of CodeView type records, and then a
third patch will hook up the reading and writing of
CodeView symbols.
Differential Revision: https://reviews.llvm.org/D26040
llvm-svn: 285836
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 5cc8b4e..fc69145 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -1690,9 +1690,9 @@
ClassOptions CO =
ClassOptions::ForwardReference | getCommonClassOptions(Ty);
std::string FullName = getFullyQualifiedName(Ty);
- TypeIndex FwdDeclTI = TypeTable.writeKnownType(ClassRecord(
- Kind, 0, CO, HfaKind::None, WindowsRTClassKind::None, TypeIndex(),
- TypeIndex(), TypeIndex(), 0, FullName, Ty->getIdentifier()));
+ TypeIndex FwdDeclTI = TypeTable.writeKnownType(
+ ClassRecord(Kind, 0, CO, TypeIndex(), TypeIndex(), TypeIndex(), 0,
+ FullName, Ty->getIdentifier()));
if (!Ty->isForwardDecl())
DeferredCompleteTypes.push_back(Ty);
return FwdDeclTI;
@@ -1716,9 +1716,9 @@
uint64_t SizeInBytes = Ty->getSizeInBits() / 8;
- TypeIndex ClassTI = TypeTable.writeKnownType(ClassRecord(
- Kind, FieldCount, CO, HfaKind::None, WindowsRTClassKind::None, FieldTI,
- TypeIndex(), VShapeTI, SizeInBytes, FullName, Ty->getIdentifier()));
+ TypeIndex ClassTI = TypeTable.writeKnownType(
+ ClassRecord(Kind, FieldCount, CO, FieldTI, TypeIndex(), VShapeTI,
+ SizeInBytes, FullName, Ty->getIdentifier()));
TypeTable.writeKnownType(UdtSourceLineRecord(
ClassTI, TypeTable.writeKnownType(StringIdRecord(
@@ -1734,8 +1734,8 @@
ClassOptions CO =
ClassOptions::ForwardReference | getCommonClassOptions(Ty);
std::string FullName = getFullyQualifiedName(Ty);
- TypeIndex FwdDeclTI = TypeTable.writeKnownType(UnionRecord(
- 0, CO, HfaKind::None, TypeIndex(), 0, FullName, Ty->getIdentifier()));
+ TypeIndex FwdDeclTI = TypeTable.writeKnownType(
+ UnionRecord(0, CO, TypeIndex(), 0, FullName, Ty->getIdentifier()));
if (!Ty->isForwardDecl())
DeferredCompleteTypes.push_back(Ty);
return FwdDeclTI;
@@ -1755,9 +1755,8 @@
uint64_t SizeInBytes = Ty->getSizeInBits() / 8;
std::string FullName = getFullyQualifiedName(Ty);
- TypeIndex UnionTI = TypeTable.writeKnownType(
- UnionRecord(FieldCount, CO, HfaKind::None, FieldTI, SizeInBytes, FullName,
- Ty->getIdentifier()));
+ TypeIndex UnionTI = TypeTable.writeKnownType(UnionRecord(
+ FieldCount, CO, FieldTI, SizeInBytes, FullName, Ty->getIdentifier()));
TypeTable.writeKnownType(UdtSourceLineRecord(
UnionTI, TypeTable.writeKnownType(StringIdRecord(
@@ -1858,11 +1857,10 @@
if (Introduced)
VFTableOffset = SP->getVirtualIndex() * getPointerSizeInBytes();
- Methods.push_back(
- OneMethodRecord(MethodType, translateMethodKindFlags(SP, Introduced),
- translateMethodOptionFlags(SP),
- translateAccessFlags(Ty->getTag(), SP->getFlags()),
- VFTableOffset, Name));
+ Methods.push_back(OneMethodRecord(
+ MethodType, translateAccessFlags(Ty->getTag(), SP->getFlags()),
+ translateMethodKindFlags(SP, Introduced),
+ translateMethodOptionFlags(SP), VFTableOffset, Name));
MemberCount++;
}
assert(Methods.size() > 0 && "Empty methods map entry");