[codeview] Have visitTypeBegin return the record type.
authorZachary Turner <zturner@google.com>
Wed, 31 Aug 2016 23:14:31 +0000 (23:14 +0000)
committerZachary Turner <zturner@google.com>
Wed, 31 Aug 2016 23:14:31 +0000 (23:14 +0000)
commit77807637ffb0fffd6f215187258b0e12c6b6a620
tree4215a4361a29ae79026b28478948056d7109fdf2
parent97e49ac59e428a935971139dc69750e25c8d2ac8
[codeview] Have visitTypeBegin return the record type.

Previously we were assuming that any visitation of types would
necessarily be against a type we had binary data for.  Reasonable
assumption when were just reading PDBs and dumping them, but once
we start writing PDBs from Yaml this breaks down, because we have
no binary data yet, only Yaml, and from that we need to read the
record kind and perform the switch based on that.

So this patch does that.  Instead of having the visitor switch
on the kind that is already in the CVType record, we change the
visitTypeBegin() method to return the Kind, and switch on the
returned value.  This way, the default implementation can still
return the value from the CVType, but the implementation which
visits Yaml records and serializes binary PDB type records can
use the field in the Yaml as the source of the switch.

llvm-svn: 280307
llvm/include/llvm/DebugInfo/CodeView/TypeDumper.h
llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h
llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h
llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
llvm/lib/DebugInfo/CodeView/TypeDumper.cpp
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp
llvm/tools/llvm-pdbdump/CodeViewYaml.cpp
llvm/tools/llvm-pdbdump/CodeViewYaml.h