summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-09-30 20:52:12 +0000
committerRui Ueyama <ruiu@google.com>2016-09-30 20:52:12 +0000
commit5d6714e59313a5fc83a0475b17dbb40dffd2a3f6 (patch)
tree7974f24bb0f4f0fac180c5be78405d39cd4b14ec /llvm/lib
parent9c2cd9aadc827875cdb58b281e2475908afb5576 (diff)
downloadbcm5719-llvm-5d6714e59313a5fc83a0475b17dbb40dffd2a3f6.tar.gz
bcm5719-llvm-5d6714e59313a5fc83a0475b17dbb40dffd2a3f6.zip
Do not pass a superblock to PDBFileBuilder.
When we create a PDB file using PDBFileBuilder, the information in the superblock, such as the size of the resulting file, is not available. Previously, PDBFileBuilder::initialize took a superblock assuming that all the members of the struct are correct. That is useful when you want to restore the exact information from a YAML file, but that's probably the only use case in which that is useful. When we are creating a PDB file on the fly, we have to backfill the members. This patch redefines PDBFileBuilder::initialize to take only a block size. Now all the other members are left as default values, so that they'll be updated when commit() is called. Differential Revision: https://reviews.llvm.org/D25108 llvm-svn: 282944
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/MSF/MSFBuilder.cpp4
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp13
2 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
index 0b378db51ff..5b1b5d8dc4d 100644
--- a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
+++ b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
@@ -19,12 +19,14 @@ const uint32_t kFreePageMap0Block = 1;
const uint32_t kFreePageMap1Block = 2;
const uint32_t kNumReservedPages = 3;
+const uint32_t kDefaultFreePageMap = kFreePageMap0Block;
const uint32_t kDefaultBlockMapAddr = kNumReservedPages;
}
MSFBuilder::MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
BumpPtrAllocator &Allocator)
- : Allocator(Allocator), IsGrowable(CanGrow), BlockSize(BlockSize),
+ : Allocator(Allocator), IsGrowable(CanGrow),
+ FreePageMap(kDefaultFreePageMap), BlockSize(BlockSize),
MininumBlocks(MinBlockCount), BlockMapAddr(kDefaultBlockMapAddr),
FreeBlocks(MinBlockCount, true) {
FreeBlocks[kSuperBlockBlock] = false;
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
index 5b9f9461608..dcd8662913c 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
@@ -32,18 +32,11 @@ using namespace llvm::support;
PDBFileBuilder::PDBFileBuilder(BumpPtrAllocator &Allocator)
: Allocator(Allocator) {}
-Error PDBFileBuilder::initialize(const msf::SuperBlock &Super) {
- auto ExpectedMsf =
- MSFBuilder::create(Allocator, Super.BlockSize, Super.NumBlocks);
+Error PDBFileBuilder::initialize(uint32_t BlockSize) {
+ auto ExpectedMsf = MSFBuilder::create(Allocator, BlockSize);
if (!ExpectedMsf)
return ExpectedMsf.takeError();
-
- auto &MsfResult = *ExpectedMsf;
- if (auto EC = MsfResult.setBlockMapAddr(Super.BlockMapAddr))
- return EC;
- Msf = llvm::make_unique<MSFBuilder>(std::move(MsfResult));
- Msf->setFreePageMap(Super.FreeBlockMapBlock);
- Msf->setUnknown1(Super.Unknown1);
+ Msf = llvm::make_unique<MSFBuilder>(std::move(*ExpectedMsf));
return Error::success();
}
OpenPOWER on IntegriCloud