summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/PDB/DIA/DIAInjectedSource.cpp4
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp11
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBExtras.cpp7
3 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIAInjectedSource.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIAInjectedSource.cpp
index 211b4e11ac4..032b230b5fa 100644
--- a/llvm/lib/DebugInfo/PDB/DIA/DIAInjectedSource.cpp
+++ b/llvm/lib/DebugInfo/PDB/DIA/DIAInjectedSource.cpp
@@ -41,11 +41,11 @@ std::string DIAInjectedSource::getVirtualFileName() const {
&IDiaInjectedSource::get_virtualFilename);
}
-PDB_SourceCompression DIAInjectedSource::getCompression() const {
+uint32_t DIAInjectedSource::getCompression() const {
DWORD Compression = 0;
if (S_OK != SourceFile->get_sourceCompression(&Compression))
return PDB_SourceCompression::None;
- return static_cast<PDB_SourceCompression>(Compression);
+ return static_cast<uint32_t>(Compression);
}
std::string DIAInjectedSource::getCode() const {
diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
index 7c7901b708c..f17ff5bb01f 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
@@ -17,14 +17,15 @@ namespace pdb {
namespace {
-Expected<std::string> readStreamData(BinaryStream &Stream) {
- uint32_t Offset = 0, DataLength = Stream.getLength();
+Expected<std::string> readStreamData(BinaryStream &Stream, uint32_t Limit) {
+ uint32_t Offset = 0, DataLength = std::min(Limit, Stream.getLength());
std::string Result;
Result.reserve(DataLength);
while (Offset < DataLength) {
ArrayRef<uint8_t> Data;
if (auto E = Stream.readLongestContiguousChunk(Offset, Data))
return std::move(E);
+ Data = Data.take_front(DataLength - Offset);
Offset += Data.size();
Result += toStringRef(Data);
}
@@ -62,9 +63,7 @@ public:
return *VName;
}
- PDB_SourceCompression getCompression() const override {
- return static_cast<PDB_SourceCompression>(Entry.Compression);
- }
+ uint32_t getCompression() const override { return Entry.Compression; }
std::string getCode() const override {
// Get name of stream storing the data.
@@ -81,7 +80,7 @@ public:
return "(failed to open data stream)";
}
- auto Data = readStreamData(**ExpectedFileStream);
+ auto Data = readStreamData(**ExpectedFileStream, Entry.FileSize);
if (!Data) {
consumeError(Data.takeError());
return "(failed to read data)";
diff --git a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
index 59eadd71856..354a99476c4 100644
--- a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -320,14 +320,17 @@ raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
return OS;
}
-raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
- const PDB_SourceCompression &Compression) {
+raw_ostream &llvm::pdb::dumpPDBSourceCompression(raw_ostream &OS,
+ uint32_t Compression) {
switch (Compression) {
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, None, OS)
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, Huffman, OS)
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, LZ, OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_SourceCompression, RunLengthEncoded, "RLE",
OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, DotNet, OS)
+ default:
+ OS << "Unknown (" << Compression << ")";
}
return OS;
}
OpenPOWER on IntegriCloud