[PATCH] D20138: Refactor CodeView TypeRecord visitors to use common structures

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 15:00:36 PDT 2016


zturner created this revision.
zturner added reviewers: rnk, amccarth.
zturner added a subscriber: llvm-commits.

If we don't want to go with the approach because it involves too much boilerplate, another approach would be to go back to what we were doing before, where we raise the Layout class outside of the memory-representation class and put the serialization on the Layout class.  One of the problems now is that there are some cases where the deserialization is conditional, or we have to extract some bitfields to convert to the in memory format, so there's always a little bit of custom marshalling involved.

If we wanted to more easily generalize the deserialization, limiting it to the layout classes could provide better code reuse since you may be able to declare the layout classes declaratively with macros and then have a single deserialization function that is templatized and works for everything due to the declarative nature of the layout classes.  Then you could have the in memory representation classes take a layout class to the constructor or something.

Either way, I don't think this is a bad first step, and I plan to generalize as much as possible using variadic templates in a followup patch.

http://reviews.llvm.org/D20138

Files:
  include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
  include/llvm/DebugInfo/CodeView/CodeView.h
  include/llvm/DebugInfo/CodeView/TypeRecord.h
  include/llvm/DebugInfo/CodeView/TypeRecords.def
  include/llvm/DebugInfo/CodeView/TypeStream.h
  include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
  lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  lib/DebugInfo/CodeView/FieldListRecordBuilder.cpp
  lib/DebugInfo/CodeView/TypeDumper.cpp
  lib/DebugInfo/CodeView/TypeStream.cpp
  lib/DebugInfo/CodeView/TypeTableBuilder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20138.56822.patch
Type: text/x-patch
Size: 105705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160510/6033b955/attachment-0001.bin>


More information about the llvm-commits mailing list