From 2f951ce9c9d3a0b23c5a6eff092e13b6b08b16f8 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Wed, 31 Aug 2016 21:42:26 +0000 Subject: [codeview] Add TypeVisitorCallbackPipeline. We were kind of hacking this together before by embedding the ability to forward requests into the TypeDeserializer. When we want to start adding more different kinds of visitor callback interfaces though, this doesn't scale well and is very inflexible. So introduce the notion of a pipeline, which itself implements the TypeVisitorCallbacks interface, but which contains an internal list of other callbacks to invoke in sequence. Also update the existing uses of CVTypeVisitor to use this new pipeline class for deserializing records before visiting them with another visitor. llvm-svn: 280293 --- llvm/tools/llvm-pdbdump/CodeViewYaml.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'llvm/tools/llvm-pdbdump/CodeViewYaml.cpp') diff --git a/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp b/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp index 690e46fb041..96bf1c19aa6 100644 --- a/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp +++ b/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp @@ -13,6 +13,7 @@ #include "llvm/DebugInfo/CodeView/EnumTables.h" #include "llvm/DebugInfo/CodeView/TypeDeserializer.h" #include "llvm/DebugInfo/CodeView/TypeRecord.h" +#include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h" using namespace llvm; using namespace llvm::codeview; @@ -240,10 +241,14 @@ template <> struct ScalarTraits { void MappingTraits::mapping(IO &IO, CVType &Record) { if (IO.outputting()) { + codeview::TypeDeserializer Deserializer; codeview::yaml::YamlTypeDumperCallbacks Callbacks(IO); - codeview::TypeDeserializer Deserializer(Callbacks); - codeview::CVTypeVisitor Visitor(Deserializer); + codeview::TypeVisitorCallbackPipeline Pipeline; + Pipeline.addCallbackToPipeline(Deserializer); + Pipeline.addCallbackToPipeline(Callbacks); + + codeview::CVTypeVisitor Visitor(Pipeline); consumeError(Visitor.visitTypeRecord(Record)); } } @@ -252,8 +257,13 @@ void MappingTraits::mapping(IO &IO, FieldListRecord &FieldList) { if (IO.outputting()) { codeview::yaml::YamlTypeDumperCallbacks Callbacks(IO); - codeview::TypeDeserializer Deserializer(Callbacks); - codeview::CVTypeVisitor Visitor(Deserializer); + codeview::TypeDeserializer Deserializer; + + codeview::TypeVisitorCallbackPipeline Pipeline; + Pipeline.addCallbackToPipeline(Deserializer); + Pipeline.addCallbackToPipeline(Callbacks); + + codeview::CVTypeVisitor Visitor(Pipeline); consumeError(Visitor.visitFieldListMemberStream(FieldList.Data)); } } -- cgit v1.2.3