summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h4
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/Raw/PDBFile.h3
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp11
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp9
4 files changed, 15 insertions, 12 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h b/llvm/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h
index a772ef1a7ae..0f8736d55c4 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h
@@ -32,8 +32,8 @@ public:
virtual ArrayRef<support::ulittle32_t>
getStreamBlockList(uint32_t StreamIndex) const = 0;
- virtual StringRef getBlockData(uint32_t BlockIndex,
- uint32_t NumBytes) const = 0;
+ virtual ArrayRef<uint8_t> getBlockData(uint32_t BlockIndex,
+ uint32_t NumBytes) const = 0;
};
}
}
diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/PDBFile.h b/llvm/include/llvm/DebugInfo/PDB/Raw/PDBFile.h
index d3f269430a7..f6ee987adcd 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Raw/PDBFile.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Raw/PDBFile.h
@@ -52,7 +52,8 @@ public:
ArrayRef<support::ulittle32_t>
getStreamBlockList(uint32_t StreamIndex) const override;
- StringRef getBlockData(uint32_t BlockIndex, uint32_t NumBytes) const override;
+ ArrayRef<uint8_t> getBlockData(uint32_t BlockIndex,
+ uint32_t NumBytes) const override;
ArrayRef<support::ulittle32_t> getDirectoryBlockArray() const;
diff --git a/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
index 03462b38863..3428ff83471 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
@@ -78,10 +78,9 @@ bool MappedBlockStream::tryReadContiguously(uint32_t Offset, uint32_t Size,
}
uint32_t FirstBlockAddr = BlockList[BlockNum];
- StringRef Str = Pdb.getBlockData(FirstBlockAddr, Pdb.getBlockSize());
- Str = Str.drop_front(OffsetInBlock);
- Buffer =
- ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(Str.data()), Size);
+ auto Data = Pdb.getBlockData(FirstBlockAddr, Pdb.getBlockSize());
+ Data = Data.drop_front(OffsetInBlock);
+ Buffer = ArrayRef<uint8_t>(Data.data(), Size);
return true;
}
@@ -103,9 +102,9 @@ Error MappedBlockStream::readBytes(uint32_t Offset,
while (BytesLeft > 0) {
uint32_t StreamBlockAddr = BlockList[BlockNum];
- StringRef Data = Pdb.getBlockData(StreamBlockAddr, Pdb.getBlockSize());
+ auto Data = Pdb.getBlockData(StreamBlockAddr, Pdb.getBlockSize());
- const char *ChunkStart = Data.data() + OffsetInBlock;
+ const uint8_t *ChunkStart = Data.data() + OffsetInBlock;
uint32_t BytesInChunk =
std::min(BytesLeft, Pdb.getBlockSize() - OffsetInBlock);
::memcpy(WriteBuffer + BytesWritten, ChunkStart, BytesInChunk);
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
index 9ef0a492e87..22094773624 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
@@ -138,11 +138,14 @@ PDBFile::getStreamBlockList(uint32_t StreamIndex) const {
return Array;
}
-StringRef PDBFile::getBlockData(uint32_t BlockIndex, uint32_t NumBytes) const {
+ArrayRef<uint8_t> PDBFile::getBlockData(uint32_t BlockIndex,
+ uint32_t NumBytes) const {
uint64_t StreamBlockOffset = blockToOffset(BlockIndex, getBlockSize());
- return StringRef(Context->Buffer->getBufferStart() + StreamBlockOffset,
- NumBytes);
+ return ArrayRef<uint8_t>(
+ reinterpret_cast<const uint8_t *>(Context->Buffer->getBufferStart()) +
+ StreamBlockOffset,
+ NumBytes);
}
Error PDBFile::parseFileHeaders() {
OpenPOWER on IntegriCloud