diff options
Diffstat (limited to 'include/llvm/DebugInfo/MSF')
-rw-r--r-- | include/llvm/DebugInfo/MSF/MSFBuilder.h | 13 | ||||
-rw-r--r-- | include/llvm/DebugInfo/MSF/MSFCommon.h | 18 | ||||
-rw-r--r-- | include/llvm/DebugInfo/MSF/MappedBlockStream.h | 20 |
3 files changed, 26 insertions, 25 deletions
diff --git a/include/llvm/DebugInfo/MSF/MSFBuilder.h b/include/llvm/DebugInfo/MSF/MSFBuilder.h index 6d067cc1c238..b2c8f2d1c20d 100644 --- a/include/llvm/DebugInfo/MSF/MSFBuilder.h +++ b/include/llvm/DebugInfo/MSF/MSFBuilder.h @@ -12,18 +12,16 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/BitVector.h" - #include "llvm/DebugInfo/MSF/MSFCommon.h" - #include "llvm/Support/Allocator.h" -#include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" - +#include <cstdint> #include <utility> #include <vector> namespace llvm { namespace msf { + class MSFBuilder { public: /// \brief Create a new `MSFBuilder`. @@ -122,7 +120,7 @@ private: Error allocateBlocks(uint32_t NumBlocks, MutableArrayRef<uint32_t> Blocks); uint32_t computeDirectoryByteSize() const; - typedef std::vector<uint32_t> BlockList; + using BlockList = std::vector<uint32_t>; BumpPtrAllocator &Allocator; @@ -136,7 +134,8 @@ private: std::vector<uint32_t> DirectoryBlocks; std::vector<std::pair<uint32_t, BlockList>> StreamData; }; -} // namespace msf -} // namespace llvm + +} // end namespace msf +} // end namespace llvm #endif // LLVM_DEBUGINFO_MSF_MSFBUILDER_H diff --git a/include/llvm/DebugInfo/MSF/MSFCommon.h b/include/llvm/DebugInfo/MSF/MSFCommon.h index 93a9c808b736..eca1b8b89ebd 100644 --- a/include/llvm/DebugInfo/MSF/MSFCommon.h +++ b/include/llvm/DebugInfo/MSF/MSFCommon.h @@ -12,15 +12,15 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/BitVector.h" - #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" #include "llvm/Support/MathExtras.h" - +#include <cstdint> #include <vector> namespace llvm { namespace msf { + static const char Magic[] = {'M', 'i', 'c', 'r', 'o', 's', 'o', 'f', 't', ' ', 'C', '/', 'C', '+', '+', ' ', 'M', 'S', 'F', ' ', '7', '.', '0', '0', @@ -50,8 +50,9 @@ struct SuperBlock { }; struct MSFLayout { - MSFLayout() : SB(nullptr) {} - const SuperBlock *SB; + MSFLayout() = default; + + const SuperBlock *SB = nullptr; BitVector FreePageMap; ArrayRef<support::ulittle32_t> DirectoryBlocks; ArrayRef<support::ulittle32_t> StreamSizes; @@ -90,15 +91,16 @@ inline uint32_t getFpmIntervalLength(const MSFLayout &L) { inline uint32_t getNumFpmIntervals(const MSFLayout &L) { uint32_t Length = getFpmIntervalLength(L); - return llvm::alignTo(L.SB->NumBlocks, Length) / Length; + return alignTo(L.SB->NumBlocks, Length) / Length; } inline uint32_t getFullFpmByteSize(const MSFLayout &L) { - return llvm::alignTo(L.SB->NumBlocks, 8) / 8; + return alignTo(L.SB->NumBlocks, 8) / 8; } Error validateSuperBlock(const SuperBlock &SB); -} // namespace msf -} // namespace llvm + +} // end namespace msf +} // end namespace llvm #endif // LLVM_DEBUGINFO_MSF_MSFCOMMON_H diff --git a/include/llvm/DebugInfo/MSF/MappedBlockStream.h b/include/llvm/DebugInfo/MSF/MappedBlockStream.h index 02f3cb09b004..6d88d2be85c9 100644 --- a/include/llvm/DebugInfo/MSF/MappedBlockStream.h +++ b/include/llvm/DebugInfo/MSF/MappedBlockStream.h @@ -1,5 +1,4 @@ -//===- MappedBlockStream.h - Discontiguous stream data in an MSF -*- C++ -//-*-===// +//==- MappedBlockStream.h - Discontiguous stream data in an MSF --*- C++ -*-==// // // The LLVM Compiler Infrastructure // @@ -13,7 +12,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/DebugInfo/MSF/MSFStreamLayout.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/BinaryStream.h" @@ -21,6 +19,7 @@ #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" #include <cstdint> +#include <memory> #include <vector> namespace llvm { @@ -40,6 +39,7 @@ struct MSFLayout; /// of bytes. class MappedBlockStream : public BinaryStream { friend class WritableMappedBlockStream; + public: static std::unique_ptr<MappedBlockStream> createStream(uint32_t BlockSize, const MSFStreamLayout &Layout, @@ -57,8 +57,8 @@ public: createDirectoryStream(const MSFLayout &Layout, BinaryStreamRef MsfData, BumpPtrAllocator &Allocator); - llvm::support::endianness getEndian() const override { - return llvm::support::little; + support::endianness getEndian() const override { + return support::little; } Error readBytes(uint32_t Offset, uint32_t Size, @@ -68,7 +68,7 @@ public: uint32_t getLength() override; - llvm::BumpPtrAllocator &getAllocator() { return Allocator; } + BumpPtrAllocator &getAllocator() { return Allocator; } void invalidateCache(); @@ -92,7 +92,7 @@ private: const MSFStreamLayout StreamLayout; BinaryStreamRef MsfData; - typedef MutableArrayRef<uint8_t> CacheEntry; + using CacheEntry = MutableArrayRef<uint8_t>; // We just store the allocator by reference. We use this to allocate // contiguous memory for things like arrays or strings that cross a block @@ -124,8 +124,8 @@ public: createFpmStream(const MSFLayout &Layout, WritableBinaryStreamRef MsfData, BumpPtrAllocator &Allocator); - llvm::support::endianness getEndian() const override { - return llvm::support::little; + support::endianness getEndian() const override { + return support::little; } Error readBytes(uint32_t Offset, uint32_t Size, @@ -141,6 +141,7 @@ public: const MSFStreamLayout &getStreamLayout() const { return ReadInterface.getStreamLayout(); } + uint32_t getBlockSize() const { return ReadInterface.getBlockSize(); } uint32_t getNumBlocks() const { return ReadInterface.getNumBlocks(); } uint32_t getStreamLength() const { return ReadInterface.getStreamLength(); } @@ -153,7 +154,6 @@ protected: private: MappedBlockStream ReadInterface; - WritableBinaryStreamRef WriteInterface; }; |