summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-03-16 20:19:11 +0000
committerZachary Turner <zturner@google.com>2017-03-16 20:19:11 +0000
commit05d5e6136f5a3f5de28ae64077200bbdc2cacfb4 (patch)
tree174f187cdc5e3253172719938718866167fb82d6 /llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
parent02278ce09f7a661865143e1fe7983024ee0ddc93 (diff)
downloadbcm5719-llvm-05d5e6136f5a3f5de28ae64077200bbdc2cacfb4.tar.gz
bcm5719-llvm-05d5e6136f5a3f5de28ae64077200bbdc2cacfb4.zip
[PDB] Add support for parsing Flags from PDB Stream.
This was discovered when running `llvm-pdbdump diff` against two files, the second of which was generated by running the first one through pdb2yaml and then yaml2pdb. The second one was missing some bytes from the PDB Stream, and tracking this down showed that at the end of the PDB Stream were some additional bytes that we were ignoring. Looking back to the reference code, these seem to specify some additional flags that indicate whether the PDB supports various optional features. This patch adds support for reading, writing, and round-tripping these flags through YAML and the raw dumper, and updates the tests accordingly. llvm-svn: 297984
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
index f5b50a127db..f019d410328 100644
--- a/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
@@ -36,8 +36,13 @@ void InfoStreamBuilder::setAge(uint32_t A) { Age = A; }
void InfoStreamBuilder::setGuid(PDB_UniqueId G) { Guid = G; }
+void InfoStreamBuilder::addFeature(PdbRaw_FeatureSig Sig) {
+ Features.push_back(Sig);
+}
+
Error InfoStreamBuilder::finalizeMsfLayout() {
- uint32_t Length = sizeof(InfoStreamHeader) + NamedStreams.finalize();
+ uint32_t Length = sizeof(InfoStreamHeader) + NamedStreams.finalize() +
+ (Features.size() + 1) * sizeof(uint32_t);
if (auto EC = Msf.setStreamSize(StreamPDB, Length))
return EC;
return Error::success();
@@ -57,5 +62,13 @@ Error InfoStreamBuilder::commit(const msf::MSFLayout &Layout,
if (auto EC = Writer.writeObject(H))
return EC;
- return NamedStreams.commit(Writer);
+ if (auto EC = NamedStreams.commit(Writer))
+ return EC;
+ if (auto EC = Writer.writeInteger(0))
+ return EC;
+ for (auto E : Features) {
+ if (auto EC = Writer.writeEnum(E))
+ return EC;
+ }
+ return Error::success();
}
OpenPOWER on IntegriCloud