diff options
| author | Zachary Turner <zturner@google.com> | 2018-06-27 21:18:15 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2018-06-27 21:18:15 +0000 |
| commit | ee8010abe330d0889b4d211e936f4a9e3c97cafc (patch) | |
| tree | e2c42d777e4468fa2893447e9f0de363197a8e77 /llvm/include | |
| parent | e214f046af3ae7313a1a868615e728233a00e3b7 (diff) | |
| download | bcm5719-llvm-ee8010abe330d0889b4d211e936f4a9e3c97cafc.tar.gz bcm5719-llvm-ee8010abe330d0889b4d211e936f4a9e3c97cafc.zip | |
Move some code from PDBFileBuilder to MSFBuilder.
The code to emit the pieces of the MSF file were actually in
PDBFileBuilder. Move this to MSFBuilder so that we can
theoretically emit an MSF without having a PDB file.
llvm-svn: 335789
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h | 7 | ||||
| -rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h | 2 | ||||
| -rw-r--r-- | llvm/include/llvm/Support/BinaryByteStream.h | 12 |
3 files changed, 19 insertions, 2 deletions
diff --git a/llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h b/llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h index c06a0b4687d..3de98c4ecba 100644 --- a/llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h +++ b/llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h @@ -20,6 +20,8 @@ #include <vector> namespace llvm { +class FileBufferByteStream; +class WritableBinaryStream; namespace msf { class MSFBuilder { @@ -109,7 +111,10 @@ public: /// Finalize the layout and build the headers and structures that describe the /// MSF layout and can be written directly to the MSF file. - Expected<MSFLayout> build(); + Expected<MSFLayout> generateLayout(); + + /// Write the MSF layout to the underlying file. + Expected<FileBufferByteStream> commit(StringRef Path, MSFLayout &Layout); BumpPtrAllocator &getAllocator() { return Allocator; } diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h b/llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h index 58dda71bf35..7f9c4cf9fa8 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h @@ -76,7 +76,7 @@ private: std::unique_ptr<MemoryBuffer> Content; }; - Expected<msf::MSFLayout> finalizeMsfLayout(); + Error finalizeMsfLayout(); Expected<uint32_t> allocateNamedStream(StringRef Name, uint32_t Size); void commitFpm(WritableBinaryStream &MsfBuffer, const msf::MSFLayout &Layout); diff --git a/llvm/include/llvm/Support/BinaryByteStream.h b/llvm/include/llvm/Support/BinaryByteStream.h index f39ac4e2413..9808d3b7215 100644 --- a/llvm/include/llvm/Support/BinaryByteStream.h +++ b/llvm/include/llvm/Support/BinaryByteStream.h @@ -222,6 +222,12 @@ private: return Error::success(); } + /// Returns a pointer to the start of the buffer. + uint8_t *getBufferStart() const { return FileBuffer->getBufferStart(); } + + /// Returns a pointer to the end of the buffer. + uint8_t *getBufferEnd() const { return FileBuffer->getBufferEnd(); } + private: std::unique_ptr<FileOutputBuffer> FileBuffer; }; @@ -253,6 +259,12 @@ public: Error commit() override { return Impl.commit(); } + /// Returns a pointer to the start of the buffer. + uint8_t *getBufferStart() const { return Impl.getBufferStart(); } + + /// Returns a pointer to the end of the buffer. + uint8_t *getBufferEnd() const { return Impl.getBufferEnd(); } + private: StreamImpl Impl; }; |

