diff options
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h | 1 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp | 4 | ||||
-rw-r--r-- | llvm/test/lit.cfg | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbutil/LLVMOutputStyle.cpp | 8 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp | 6 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 9 |
6 files changed, 26 insertions, 4 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h b/llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h index 1c38c2b6194..fc91fc7097b 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h @@ -35,6 +35,7 @@ public: uint32_t getStreamSize() const; + bool containsIdStream() const; PdbRaw_ImplVer getVersion() const; uint32_t getSignature() const; uint32_t getAge() const; diff --git a/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp b/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp index 7c6069652da..a3979d480bf 100644 --- a/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp @@ -102,6 +102,10 @@ InfoStream::named_streams() const { return NamedStreams.entries(); } +bool InfoStream::containsIdStream() const { + return !!(Features & PdbFeatureContainsIdStream); +} + PdbRaw_ImplVer InfoStream::getVersion() const { return static_cast<PdbRaw_ImplVer>(Version); } diff --git a/llvm/test/lit.cfg b/llvm/test/lit.cfg index 5e903c26657..ed1ba2d11b1 100644 --- a/llvm/test/lit.cfg +++ b/llvm/test/lit.cfg @@ -301,7 +301,7 @@ for pattern in [r"\bbugpoint\b(?!-)", r"\bllvm-modextract\b", r"\bllvm-nm\b", r"\bllvm-objdump\b", - r"\bllvm-pdbdump\b", + r"\bllvm-pdbutil\b", r"\bllvm-profdata\b", r"\bllvm-ranlib\b", r"\bllvm-readobj\b", diff --git a/llvm/tools/llvm-pdbutil/LLVMOutputStyle.cpp b/llvm/tools/llvm-pdbutil/LLVMOutputStyle.cpp index 824f88f8efd..444541a0773 100644 --- a/llvm/tools/llvm-pdbutil/LLVMOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/LLVMOutputStyle.cpp @@ -739,10 +739,12 @@ Error LLVMOutputStyle::dumpTpiStream(uint32_t StreamIdx) { Label = "Type Info Stream (TPI)"; VerLabel = "TPI Version"; } else if (StreamIdx == StreamIPI) { - if (!File.hasPDBIpiStream()) { - P.printString("Type Info Stream (IPI) not present"); + auto InfoS = File.getPDBInfoStream(); + if (!InfoS) + return InfoS.takeError(); + + if (!File.hasPDBIpiStream() || !InfoS->containsIdStream()) return Error::success(); - } DumpRecordBytes = opts::raw::DumpIpiRecordBytes; DumpRecords = opts::raw::DumpIpiRecords; Label = "Type Info Stream (IPI)"; diff --git a/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp b/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp index 58c538d968c..4ab7cd39b29 100644 --- a/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp @@ -293,6 +293,12 @@ Error YAMLOutputStyle::dumpIpiStream() { if (!opts::pdb2yaml::IpiStream) return Error::success(); + auto InfoS = File.getPDBInfoStream(); + if (!InfoS) + return InfoS.takeError(); + if (!InfoS->containsIdStream()) + return Error::success(); + auto IpiS = File.getPDBIpiStream(); if (!IpiS) return IpiS.takeError(); diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp index f6b6a156a76..44ab0d93aea 100644 --- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp +++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -580,6 +580,14 @@ 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)); } @@ -855,6 +863,7 @@ static void mergePdbs() { MergedIpi.ForEachRecord([&DestIpi](TypeIndex TI, ArrayRef<uint8_t> Data) { DestIpi.addTypeRecord(Data, None); }); + Builder.getInfoBuilder().addFeature(PdbRaw_FeatureSig::VC140); SmallString<64> OutFile(opts::merge::PdbOutputFile); if (OutFile.empty()) { |