[PATCH] D26040: [CodeView] Add CodeViewRecordIO for reading and writing, and use it for reading type records.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 11:45:27 PDT 2016


zturner created this revision.
zturner added reviewers: rnk, amccarth, inglorion.
zturner added a subscriber: llvm-commits.
Herald added subscribers: modocache, mgorny.

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:

1. 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.
2. Introduces `TypeRecordMapping` which uses `CodeViewRecordIO` to define the layout of CodeView Type records.
3. 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:

1. 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.


https://reviews.llvm.org/D26040

Files:
  include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
  include/llvm/DebugInfo/CodeView/TypeDeserializer.h
  include/llvm/DebugInfo/CodeView/TypeIndex.h
  include/llvm/DebugInfo/CodeView/TypeRecord.h
  include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
  include/llvm/DebugInfo/MSF/StreamWriter.h
  lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  lib/DebugInfo/CodeView/CMakeLists.txt
  lib/DebugInfo/CodeView/CVTypeVisitor.cpp
  lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  lib/DebugInfo/CodeView/TypeDumper.cpp
  lib/DebugInfo/CodeView/TypeRecord.cpp
  lib/DebugInfo/CodeView/TypeRecordMapping.cpp
  lib/DebugInfo/CodeView/TypeStreamMerger.cpp
  lib/DebugInfo/CodeView/TypeTableBuilder.cpp
  lib/DebugInfo/MSF/StreamWriter.cpp
  test/DebugInfo/PDB/pdbdump-yaml-types.test
  tools/llvm-pdbdump/YamlTypeDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26040.76073.patch
Type: text/x-patch
Size: 134161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161027/10fcb4ec/attachment-0001.bin>


More information about the llvm-commits mailing list