[llvm] r305236 - Slightly better fix for dealing with no-id-stream PDBs.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 12 14:46:52 PDT 2017
Author: zturner
Date: Mon Jun 12 16:46:51 2017
New Revision: 305236
URL: http://llvm.org/viewvc/llvm-project?rev=305236&view=rev
Log:
Slightly better fix for dealing with no-id-stream PDBs.
The last fix required the user to manually add the required
feature. This caused an LLD test to fail because I failed to
update LLD. In practice we can hide this logic so it can just
be transparently added when we write the PDB.
Modified:
llvm/trunk/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h
llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h?rev=305236&r1=305235&r2=305236&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h Mon Jun 12 16:46:51 2017
@@ -58,6 +58,8 @@ public:
Error finalizeMsfLayout();
+ uint32_t getRecordCount() const { return TypeRecords.size(); }
+
Error commit(const msf::MSFLayout &Layout, WritableBinaryStreamRef Buffer);
uint32_t calculateSerializedLength();
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp?rev=305236&r1=305235&r2=305236&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp Mon Jun 12 16:46:51 2017
@@ -80,6 +80,16 @@ Error PDBFileBuilder::addNamedStream(Str
}
Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() {
+
+ if (Ipi && Ipi->getRecordCount() > 0) {
+ // In theory newer PDBs always have an ID stream, but by saying that we're
+ // only going to *really* have an ID stream if there is at least one ID
+ // record, we leave open the opportunity to test older PDBs such as those
+ // that don't have an ID stream.
+ auto &Info = getInfoBuilder();
+ Info.addFeature(PdbRaw_FeatureSig::VC140);
+ }
+
uint32_t StringsLen = Strings.calculateSerializedSize();
if (auto EC = addNamedStream("/names", StringsLen))
Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=305236&r1=305235&r2=305236&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp Mon Jun 12 16:46:51 2017
@@ -580,14 +580,6 @@ static void yamlToPdb(StringRef Path) {
IpiBuilder.addTypeRecord(Type.RecordData, None);
}
- if (!Ipi.Records.empty()) {
- // In theory newer PDBs always have an ID stream, but by saying that we're
- // only going to *really* have an ID stream if there is at least one ID
- // record, we leave open the opportunity to test older PDBs such as those
- // that don't have an ID stream.
- InfoBuilder.addFeature(PdbRaw_FeatureSig::VC140);
- }
-
ExitOnErr(Builder.commit(opts::yaml2pdb::YamlPdbOutputFile));
}
More information about the llvm-commits
mailing list