aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-07-11 21:45:26 +0000
committerZachary Turner <zturner@google.com>2016-07-11 21:45:26 +0000
commitdbeaea7b357fb4343d01ffa466f3dcab1e57d392 (patch)
treef1fd778564c5e85b31e96504ee26b49424b00823 /llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
parentf6b93824677a9aaab59989f7f402010fda6bd63c (diff)
downloadllvm-dbeaea7b357fb4343d01ffa466f3dcab1e57d392.zip
llvm-dbeaea7b357fb4343d01ffa466f3dcab1e57d392.tar.gz
llvm-dbeaea7b357fb4343d01ffa466f3dcab1e57d392.tar.bz2
Refactor the PDB writing to use a builder approach
llvm-svn: 275110
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
index ce2446c..2aa4d4c 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
@@ -173,17 +173,6 @@ llvm::ArrayRef<support::ulittle32_t> PDBFile::getDirectoryBlockArray() const {
return DirectoryBlocks;
}
-Expected<InfoStream &> PDBFile::emplacePDBInfoStream() {
- if (Info)
- Info.reset();
-
- auto InfoS = MappedBlockStream::createIndexedStream(StreamPDB, *this);
- if (!InfoS)
- return InfoS.takeError();
- Info = llvm::make_unique<InfoStream>(std::move(*InfoS));
- return *Info;
-}
-
Expected<InfoStream &> PDBFile::getPDBInfoStream() {
if (!Info) {
auto InfoS = MappedBlockStream::createIndexedStream(StreamPDB, *this);
@@ -352,64 +341,6 @@ Error PDBFile::setSuperBlock(const SuperBlock *Block) {
return Error::success();
}
-void PDBFile::setStreamSizes(ArrayRef<support::ulittle32_t> Sizes) {
- StreamSizes = Sizes;
-}
-
-void PDBFile::setStreamMap(
- std::vector<ArrayRef<support::ulittle32_t>> &Streams) {
- StreamMap = Streams;
-}
-
-void PDBFile::setDirectoryBlocks(ArrayRef<support::ulittle32_t> Directory) {
- DirectoryBlocks = Directory;
-}
-
-Error PDBFile::generateSimpleStreamMap() {
- if (StreamSizes.empty())
- return Error::success();
-
- static std::vector<std::vector<support::ulittle32_t>> StaticMap;
- StreamMap.clear();
- StaticMap.clear();
-
- // Figure out how many blocks are needed for all streams, and set the first
- // used block to the highest block so that we can write the rest of the
- // blocks contiguously.
- uint32_t TotalFileBlocks = getBlockCount();
- std::vector<support::ulittle32_t> ReservedBlocks;
- ReservedBlocks.push_back(support::ulittle32_t(0));
- ReservedBlocks.push_back(SB->BlockMapAddr);
- ReservedBlocks.insert(ReservedBlocks.end(), DirectoryBlocks.begin(),
- DirectoryBlocks.end());
-
- uint32_t BlocksNeeded = 0;
- for (auto Size : StreamSizes)
- BlocksNeeded += bytesToBlocks(Size, getBlockSize());
-
- support::ulittle32_t NextBlock(TotalFileBlocks - BlocksNeeded -
- ReservedBlocks.size());
-
- StaticMap.resize(StreamSizes.size());
- for (uint32_t S = 0; S < StreamSizes.size(); ++S) {
- uint32_t Size = StreamSizes[S];
- uint32_t NumBlocks = bytesToBlocks(Size, getBlockSize());
- auto &ThisStream = StaticMap[S];
- for (uint32_t I = 0; I < NumBlocks;) {
- NextBlock += 1;
- if (std::find(ReservedBlocks.begin(), ReservedBlocks.end(), NextBlock) !=
- ReservedBlocks.end())
- continue;
-
- ++I;
- assert(NextBlock < getBlockCount());
- ThisStream.push_back(NextBlock);
- }
- StreamMap.push_back(ThisStream);
- }
- return Error::success();
-}
-
Error PDBFile::commit() {
StreamWriter Writer(*Buffer);