This is the first of two patches intended to merge the reading and writing codepaths for CodeView symbol and type records. This patch contains the following pieces:
- Introduces CodeViewRecordIO, which is similar to YamlIO in that it provides a single interface for reading or writing native types from an underlying byte stream, depending on what mode the class is in.
- Introduces TypeRecordMapping which uses CodeViewRecordIO to define the layout of CodeView Type records.
- Hook TypeRecordMapping up to the existing Pdb -> Yaml code to prove that it works in "reading" (e.g. bytes -> semantic record) mode.
What this patch does NOT do:
- Add any of the writing support. Doing so is somewhat non-trivial, as it requires taking all of the logic from TypeRecordBuilder, TypeTableBuilder, ListRecordBuilder, and dealing with record splitting and many other intricacies. That will be part 2 of this review sequence. I have that patch fully working and tested, but it will make this quite large and difficult to review to do it all at once.
Just to be clear: After patch 2, TypeTableBuilder, TypeRecordBuilder, ListRecordBuilder, and MemoryTypeTableBuilder will be deleted. The only thing left will be TypeRecordMapping and perhaps a small facade on top of that to simplify the interface.
Looking out further than that, with patch 3 (which I have not started working on yet), I plan to introduce a SymbolRecordMapping class. This will allow us to then delete all of the deserialize methods in SymbolRecord.h, the entire files RecordSerialization.h and RecordSerialization.cpp, and additionally give us Symbol serialization (which we do not yet have) for free.