diff options
| author | Zachary Turner <zturner@google.com> | 2016-08-18 16:49:29 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-08-18 16:49:29 +0000 |
| commit | ac5763eca45d20466eb180928ec5afe231c11d4e (patch) | |
| tree | d8e836c16af8b15a167ec7bab10e42bd4e615aa3 /llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp | |
| parent | c6bf547564088ad0ba0b2f281ffa813974f66bda (diff) | |
| download | bcm5719-llvm-ac5763eca45d20466eb180928ec5afe231c11d4e.tar.gz bcm5719-llvm-ac5763eca45d20466eb180928ec5afe231c11d4e.zip | |
Resubmit "Write the TPI stream from a PDB to Yaml."
The original patch was breaking some buildbots due to an
incorrect ordering of function definitions which caused some
compilers to recognize a definition but others to not.
llvm-svn: 279089
Diffstat (limited to 'llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp')
| -rw-r--r-- | llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp b/llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp index ff3d5d1cfd9..1277b01df9e 100644 --- a/llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp +++ b/llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp @@ -16,6 +16,7 @@ #include "llvm/DebugInfo/PDB/Raw/InfoStream.h" #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" +#include "llvm/DebugInfo/PDB/Raw/TpiStream.h" using namespace llvm; using namespace llvm::pdb; @@ -45,6 +46,9 @@ Error YAMLOutputStyle::dump() { if (auto EC = dumpDbiStream()) return EC; + if (auto EC = dumpTpiStream()) + return EC; + flush(); return Error::success(); } @@ -150,6 +154,30 @@ Error YAMLOutputStyle::dumpDbiStream() { return Error::success(); } +Error YAMLOutputStyle::dumpTpiStream() { + if (!opts::pdb2yaml::TpiStream) + return Error::success(); + + auto TpiS = File.getPDBTpiStream(); + if (!TpiS) + return TpiS.takeError(); + + auto &TS = TpiS.get(); + Obj.TpiStream.emplace(); + Obj.TpiStream->Version = TS.getTpiVersion(); + for (auto &Record : TS.types(nullptr)) { + yaml::PdbTpiRecord R; + // It's not necessary to set R.RecordData here. That only exists as a + // way to have the `PdbTpiRecord` structure own the memory that `R.Record` + // references. In the case of reading an existing PDB though, that memory + // is owned by the backing stream. + R.Record = Record; + Obj.TpiStream->Records.push_back(R); + } + + return Error::success(); +} + void YAMLOutputStyle::flush() { Out << Obj; outs().flush(); |

