summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-03-01 18:00:29 +0000
committerZachary Turner <zturner@google.com>2018-03-01 18:00:29 +0000
commitc6a75a69f15e42dd4c6b1a79f6d1a4e3df9f75ea (patch)
treed4d58a047c8d2637ccfa968decf1ba642a6e7a19 /llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
parent621cef600b4d7c466113d0a8b05ee1bf5cc07fc5 (diff)
downloadbcm5719-llvm-c6a75a69f15e42dd4c6b1a79f6d1a4e3df9f75ea.tar.gz
bcm5719-llvm-c6a75a69f15e42dd4c6b1a79f6d1a4e3df9f75ea.zip
[PDB] Defer writing the build id until the rest of the PDB is written.
For now this is NFC, but this small refactor opens the door to letting us embed a hash of the PDB in the build id field of the PDB. Differential Revision: https://reviews.llvm.org/D43913 llvm-svn: 326453
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
index 6ab748c160b..a20b45111cf 100644
--- a/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
@@ -25,15 +25,17 @@ using namespace llvm::pdb;
InfoStreamBuilder::InfoStreamBuilder(msf::MSFBuilder &Msf,
NamedStreamMap &NamedStreams)
- : Msf(Msf), Ver(PdbRaw_ImplVer::PdbImplVC70), Sig(-1), Age(0),
- NamedStreams(NamedStreams) {}
+ : Msf(Msf), Ver(PdbRaw_ImplVer::PdbImplVC70), Age(0),
+ NamedStreams(NamedStreams) {
+ ::memset(&Guid, 0, sizeof(Guid));
+}
void InfoStreamBuilder::setVersion(PdbRaw_ImplVer V) { Ver = V; }
-void InfoStreamBuilder::setSignature(uint32_t S) { Sig = S; }
-
void InfoStreamBuilder::setAge(uint32_t A) { Age = A; }
+void InfoStreamBuilder::setSignature(uint32_t S) { Signature = S; }
+
void InfoStreamBuilder::setGuid(GUID G) { Guid = G; }
void InfoStreamBuilder::addFeature(PdbRaw_FeatureSig Sig) {
@@ -56,10 +58,10 @@ Error InfoStreamBuilder::commit(const msf::MSFLayout &Layout,
BinaryStreamWriter Writer(*InfoS);
InfoStreamHeader H;
- H.Age = Age;
- H.Signature = Sig;
+ // Leave the build id fields 0 so they can be set as the last step before
+ // committing the file to disk.
+ ::memset(&H, 0, sizeof(H));
H.Version = Ver;
- H.Guid = Guid;
if (auto EC = Writer.writeObject(H))
return EC;
OpenPOWER on IntegriCloud