summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-08-31 21:42:26 +0000
committerZachary Turner <zturner@google.com>2016-08-31 21:42:26 +0000
commit2f951ce9c9d3a0b23c5a6eff092e13b6b08b16f8 (patch)
treee5e300379ab86f6fd3e6b0c126a487dbf9e5f614 /llvm/tools
parent11a235467088c800fe0a7323cb18a55fe9fe0cd3 (diff)
downloadbcm5719-llvm-2f951ce9c9d3a0b23c5a6eff092e13b6b08b16f8.tar.gz
bcm5719-llvm-2f951ce9c9d3a0b23c5a6eff092e13b6b08b16f8.zip
[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
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-pdbdump/CodeViewYaml.cpp18
-rw-r--r--llvm/tools/llvm-pdbdump/PdbYaml.cpp11
2 files changed, 22 insertions, 7 deletions
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<APSInt> {
void MappingTraits<CVType>::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<FieldListRecord>::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));
}
}
diff --git a/llvm/tools/llvm-pdbdump/PdbYaml.cpp b/llvm/tools/llvm-pdbdump/PdbYaml.cpp
index 187264acdbe..566d6b89986 100644
--- a/llvm/tools/llvm-pdbdump/PdbYaml.cpp
+++ b/llvm/tools/llvm-pdbdump/PdbYaml.cpp
@@ -8,10 +8,12 @@
//===----------------------------------------------------------------------===//
#include "PdbYaml.h"
+
#include "CodeViewYaml.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h"
#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
@@ -200,11 +202,14 @@ void MappingTraits<PdbDbiModuleInfo>::mapping(IO &IO, PdbDbiModuleInfo &Obj) {
void MappingTraits<PdbTpiRecord>::mapping(IO &IO,
pdb::yaml::PdbTpiRecord &Obj) {
if (IO.outputting()) {
- // If we're going from Pdb To Yaml, deserialize the Pdb record
+ 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(Obj.Record));
} else {
codeview::yaml::YamlTypeDumperCallbacks Callbacks(IO);
OpenPOWER on IntegriCloud