#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/Support/Endian.h"
namespace llvm {
#define LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
namespace llvm {
namespace codeview {
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/MemoryBuffer.h"
Error readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) const override {
if (Offset > Data.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (Data.size() < Size + Offset)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
Buffer = Data.slice(Offset, Size);
return Error::success();
}
Error readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) const override {
if (Offset >= Data.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
Buffer = Data.slice(Offset);
return Error::success();
}
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) const override {
if (Data.size() < Buffer.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (Offset > Buffer.size() - Data.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
uint8_t *DataPtr = const_cast<uint8_t *>(Data.data());
::memcpy(DataPtr + Offset, Buffer.data(), Buffer.size());
Error commit() const override {
if (FileBuffer->commit())
- return llvm::make_error<MSFError>(msf_error_code::not_writable);
+ return llvm::make_error<MsfError>(msf_error_code::not_writable);
return Error::success();
}
-//===- IMSFFile.h - Abstract base class for an MSF file ---------*- C++ -*-===//
+//===- IMsfFile.h - Abstract base class for an MSF file ---------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace msf {
-class IMSFFile {
+class IMsfFile {
public:
- virtual ~IMSFFile() {}
+ virtual ~IMsfFile() {}
virtual uint32_t getBlockSize() const = 0;
virtual uint32_t getBlockCount() const = 0;
-//===- MappedBlockStream.h - Discontiguous stream data in an MSF -*- C++
+//===- MappedBlockStream.h - Discontiguous stream data in an Msf -*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
-#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/MsfStreamLayout.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace msf {
-struct MSFLayout;
+struct MsfLayout;
-/// MappedBlockStream represents data stored in an MSF file into chunks of a
+/// MappedBlockStream represents data stored in an Msf file into chunks of a
/// particular size (called the Block Size), and whose chunks may not be
-/// necessarily contiguous. The arrangement of these chunks MSF the file
-/// is described by some other metadata contained within the MSF file. In
-/// the case of a standard MSF Stream, the layout of the stream's blocks
-/// is described by the MSF "directory", but in the case of the directory
+/// necessarily contiguous. The arrangement of these chunks within the file
+/// is described by some other metadata contained within the Msf file. In
+/// the case of a standard Msf Stream, the layout of the stream's blocks
+/// is described by the Msf "directory", but in the case of the directory
/// itself, the layout is described by an array at a fixed location within
-/// the MSF. MappedBlockStream provides methods for reading from and writing
+/// the Msf. MappedBlockStream provides methods for reading from and writing
/// to one of these streams transparently, as if it were a contiguous sequence
/// of bytes.
class MappedBlockStream : public ReadableStream {
public:
static std::unique_ptr<MappedBlockStream>
createStream(uint32_t BlockSize, uint32_t NumBlocks,
- const MSFStreamLayout &Layout, const ReadableStream &MsfData);
+ const MsfStreamLayout &Layout, const ReadableStream &MsfData);
static std::unique_ptr<MappedBlockStream>
- createIndexedStream(const MSFLayout &Layout, const ReadableStream &MsfData,
+ createIndexedStream(const MsfLayout &Layout, const ReadableStream &MsfData,
uint32_t StreamIndex);
static std::unique_ptr<MappedBlockStream>
- createDirectoryStream(const MSFLayout &Layout, const ReadableStream &MsfData);
+ createDirectoryStream(const MsfLayout &Layout, const ReadableStream &MsfData);
Error readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) const override;
protected:
MappedBlockStream(uint32_t BlockSize, uint32_t NumBlocks,
- const MSFStreamLayout &StreamLayout,
+ const MsfStreamLayout &StreamLayout,
const ReadableStream &MsfData);
private:
- const MSFStreamLayout &getStreamLayout() const { return StreamLayout; }
+ const MsfStreamLayout &getStreamLayout() const { return StreamLayout; }
void fixCacheAfterWrite(uint32_t Offset, ArrayRef<uint8_t> Data) const;
Error readBytes(uint32_t Offset, MutableArrayRef<uint8_t> Buffer) const;
const uint32_t BlockSize;
const uint32_t NumBlocks;
- const MSFStreamLayout StreamLayout;
+ const MsfStreamLayout StreamLayout;
const ReadableStream &MsfData;
typedef MutableArrayRef<uint8_t> CacheEntry;
public:
static std::unique_ptr<WritableMappedBlockStream>
createStream(uint32_t BlockSize, uint32_t NumBlocks,
- const MSFStreamLayout &Layout, const WritableStream &MsfData);
+ const MsfStreamLayout &Layout, const WritableStream &MsfData);
static std::unique_ptr<WritableMappedBlockStream>
- createIndexedStream(const MSFLayout &Layout, const WritableStream &MsfData,
+ createIndexedStream(const MsfLayout &Layout, const WritableStream &MsfData,
uint32_t StreamIndex);
static std::unique_ptr<WritableMappedBlockStream>
- createDirectoryStream(const MSFLayout &Layout, const WritableStream &MsfData);
+ createDirectoryStream(const MsfLayout &Layout, const WritableStream &MsfData);
Error readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) const override;
Error commit() const override;
- const MSFStreamLayout &getStreamLayout() const {
+ const MsfStreamLayout &getStreamLayout() const {
return ReadInterface.getStreamLayout();
}
uint32_t getBlockSize() const { return ReadInterface.getBlockSize(); }
protected:
WritableMappedBlockStream(uint32_t BlockSize, uint32_t NumBlocks,
- const MSFStreamLayout &StreamLayout,
+ const MsfStreamLayout &StreamLayout,
const WritableStream &MsfData);
private:
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
-#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/Msf/MsfCommon.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Endian.h"
namespace llvm {
namespace msf {
-class MSFBuilder {
+class MsfBuilder {
public:
- /// \brief Create a new `MSFBuilder`.
+ /// \brief Create a new `MsfBuilder`.
///
/// \param BlockSize The internal block size used by the PDB file. See
/// isValidBlockSize() for a list of valid block sizes.
///
/// \param MinBlockCount Causes the builder to reserve up front space for
- /// at least `MinBlockCount` blocks. This is useful when using `MSFBuilder`
+ /// at least `MinBlockCount` blocks. This is useful when using `MsfBuilder`
/// to read an existing MSF that you want to write back out later. The
/// original MSF file's SuperBlock contains the exact number of blocks used
/// by the file, so is a good hint as to how many blocks the new MSF file
/// failed. Currently the only way this can fail is if an invalid block size
/// is specified, or `MinBlockCount` does not leave enough room for the
/// mandatory reserved blocks required by an MSF file.
- static Expected<MSFBuilder> create(BumpPtrAllocator &Allocator,
+ static Expected<MsfBuilder> create(BumpPtrAllocator &Allocator,
uint32_t BlockSize,
uint32_t MinBlockCount = 0,
bool CanGrow = true);
/// Update the size of an existing stream. This will allocate or deallocate
/// blocks as needed to match the requested size. This can fail if `CanGrow`
- /// was set to false when initializing the `MSFBuilder`.
+ /// was set to false when initializing the `MsfBuilder`.
Error setStreamSize(uint32_t Idx, uint32_t Size);
/// Get the total number of streams in the MSF layout. This should return 1
/// 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> build();
private:
- MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
+ MsfBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
BumpPtrAllocator &Allocator);
Error allocateBlocks(uint32_t NumBlocks, MutableArrayRef<uint32_t> Blocks);
-//===- MSFCommon.h - Common types and functions for MSF files ---*- C++ -*-===//
+//===- MsfCommon.h - Common types and functions for MSF files ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
support::ulittle32_t BlockMapAddr;
};
-struct MSFLayout {
- MSFLayout() : SB(nullptr) {}
+struct MsfLayout {
+ MsfLayout() : SB(nullptr) {}
const SuperBlock *SB;
ArrayRef<support::ulittle32_t> DirectoryBlocks;
ArrayRef<support::ulittle32_t> StreamSizes;
-//===- MSFError.h - Error extensions for MSF Files --------------*- C++ -*-===//
+//===- MsfError.h - Error extensions for Msf Files --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
};
/// Base class for errors originating when parsing raw PDB files
-class MSFError : public ErrorInfo<MSFError> {
+class MsfError : public ErrorInfo<MsfError> {
public:
static char ID;
- MSFError(msf_error_code C);
- MSFError(const std::string &Context);
- MSFError(msf_error_code C, const std::string &Context);
+ MsfError(msf_error_code C);
+ MsfError(const std::string &Context);
+ MsfError(msf_error_code C, const std::string &Context);
void log(raw_ostream &OS) const override;
const std::string &getErrorMessage() const;
-//===- MSFStreamLayout.h - Describes the layout of a stream -----*- C++ -*-===//
+//===- MsfStreamLayout.h - Describes the layout of a stream -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
namespace llvm {
namespace msf {
-/// \brief Describes the layout of a stream in an MSF layout. A "stream" here
-/// is defined as any logical unit of data which may be arranged inside the MSF
+/// \brief Describes the layout of a stream in an Msf layout. A "stream" here
+/// is defined as any logical unit of data which may be arranged inside the Msf
/// file as a sequence of (possibly discontiguous) blocks. When we want to read
-/// from a particular MSF Stream, we fill out a stream layout structure and the
-/// reader uses it to determine which blocks in the underlying MSF file contain
+/// from a particular Msf Stream, we fill out a stream layout structure and the
+/// reader uses it to determine which blocks in the underlying Msf file contain
/// the data, so that it can be pieced together in the right order.
-class MSFStreamLayout {
+class MsfStreamLayout {
public:
uint32_t Length;
ArrayRef<support::ulittle32_t> Blocks;
#ifndef LLVM_DEBUGINFO_MSF_STREAMARRAY_H
#define LLVM_DEBUGINFO_MSF_STREAMARRAY_H
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/Support/Error.h"
#include <functional>
#define LLVM_DEBUGINFO_MSF_STREAMREADER_H
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
}
if (NumElements > UINT32_MAX / sizeof(T))
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (auto EC = readBytes(Bytes, NumElements * sizeof(T)))
return EC;
}
uint32_t Length = NumItems * sizeof(T);
if (Length / sizeof(T) != NumItems)
- return make_error<MSFError>(msf_error_code::invalid_format);
+ return make_error<MsfError>(msf_error_code::invalid_format);
if (Offset + Length > Stream.getLength())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
ReadableStreamRef View = Stream.slice(Offset, Length);
Array = FixedStreamArray<T>(View);
Offset += Length;
#ifndef LLVM_DEBUGINFO_MSF_STREAMREF_H
#define LLVM_DEBUGINFO_MSF_STREAMREF_H
-#include "llvm/DebugInfo/MSF/MSFError.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
namespace llvm {
namespace msf {
Error readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) const {
if (ViewOffset + Offset < Offset)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (Size + Offset > Length)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
return Stream->readBytes(ViewOffset + Offset, Size, Buffer);
}
Error readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) const {
if (Offset >= Length)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (auto EC = Stream->readLongestContiguousChunk(Offset, Buffer))
return EC;
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const {
if (Data.size() + Offset > Length)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
return Stream->writeBytes(ViewOffset + Offset, Data);
}
#define LLVM_DEBUGINFO_MSF_STREAMWRITER_H
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
return Error::success();
if (Array.size() > UINT32_MAX / sizeof(T))
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
return writeBytes(
ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(Array.data()),
#define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Error.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/ByteStream.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
Expected<std::unique_ptr<DbiStream>> build(PDBFile &File,
const msf::WritableStream &Buffer);
- Error commit(const msf::MSFLayout &Layout,
+ Error commit(const msf::MsfLayout &Layout,
const msf::WritableStream &Buffer) const;
private:
#define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAM_H
#include "llvm/ADT/StringMap.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
Expected<std::unique_ptr<InfoStream>>
build(PDBFile &File, const msf::WritableStream &Buffer);
- Error commit(const msf::MSFLayout &Layout,
+ Error commit(const msf::MsfLayout &Layout,
const msf::WritableStream &Buffer) const;
private:
#define LLVM_DEBUGINFO_PDB_RAW_MODINFO_H
#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
#include "llvm/Support/Endian.h"
#include <cstdint>
#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/Support/Error.h"
namespace llvm {
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstdint>
#define LLVM_DEBUGINFO_PDB_RAW_PDBFILE_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/DebugInfo/MSF/IMSFFile.h"
-#include "llvm/DebugInfo/MSF/MSFCommon.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/IMsfFile.h"
+#include "llvm/DebugInfo/Msf/MsfCommon.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
class SymbolStream;
class TpiStream;
-class PDBFile : public msf::IMSFFile {
+class PDBFile : public msf::IMsfFile {
friend PDBFileBuilder;
public:
return ContainerLayout.StreamMap;
}
- const msf::MSFLayout &getMsfLayout() const { return ContainerLayout; }
+ const msf::MsfLayout &getMsfLayout() const { return ContainerLayout; }
const msf::ReadableStream &getMsfBuffer() const { return *Buffer; }
ArrayRef<support::ulittle32_t> getDirectoryBlockArray() const;
std::unique_ptr<msf::ReadableStream> Buffer;
- msf::MSFLayout ContainerLayout;
+ msf::MsfLayout ContainerLayout;
std::unique_ptr<InfoStream> Info;
std::unique_ptr<DbiStream> Dbi;
namespace llvm {
namespace msf {
-class MSFBuilder;
+class MsfBuilder;
}
namespace pdb {
class DbiStreamBuilder;
Error initialize(const msf::SuperBlock &Super);
- msf::MSFBuilder &getMsfBuilder();
+ msf::MsfBuilder &getMsfBuilder();
InfoStreamBuilder &getInfoBuilder();
DbiStreamBuilder &getDbiBuilder();
Error commit(const msf::WritableStream &Buffer);
private:
- Expected<msf::MSFLayout> finalizeMsfLayout() const;
+ Expected<msf::MsfLayout> finalizeMsfLayout() const;
BumpPtrAllocator &Allocator;
- std::unique_ptr<msf::MSFBuilder> Msf;
+ std::unique_ptr<msf::MsfBuilder> Msf;
std::unique_ptr<InfoStreamBuilder> Info;
std::unique_ptr<DbiStreamBuilder> Dbi;
};
#define LLVM_DEBUGINFO_PDB_RAW_PUBLICSSTREAM_H
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
#define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/ByteStream.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/IR/Constants.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
type = Library
name = AsmPrinter
parent = Libraries
-required_libraries = Analysis CodeGen Core DebugInfoCodeView DebugInfoMSF MC MCParser Support Target TransformUtils
+required_libraries = Analysis CodeGen Core DebugInfoCodeView DebugInfoMsf MC MCParser Support Target TransformUtils
add_subdirectory(DWARF)
-add_subdirectory(MSF)
+add_subdirectory(Msf)
add_subdirectory(CodeView)
add_subdirectory(PDB)
add_subdirectory(Symbolize)
type = Library
name = DebugInfoCodeView
parent = DebugInfo
-required_libraries = Support DebugInfoMSF
+required_libraries = Support DebugInfoMsf
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
using namespace llvm;
using namespace llvm::codeview;
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
using namespace llvm;
using namespace llvm::codeview;
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
+#include "llvm/DebugInfo/Msf/ByteStream.h"
#include "llvm/Support/ScopedPrinter.h"
using namespace llvm;
;===------------------------------------------------------------------------===;
[common]
-subdirectories = DWARF MSF CodeView PDB Symbolize
+subdirectories = DWARF Msf CodeView PDB Symbolize
[component_0]
type = Group
-add_llvm_library(LLVMDebugInfoMSF
+add_llvm_library(LLVMDebugInfoMsf
MappedBlockStream.cpp
- MSFBuilder.cpp
- MSFCommon.cpp
- MSFError.cpp
+ MsfBuilder.cpp
+ MsfCommon.cpp
+ MsfError.cpp
StreamReader.cpp
StreamWriter.cpp
ADDITIONAL_HEADER_DIRS
-;===- ./lib/DebugInfo/MSF/LLVMBuild.txt -------------------*- Conf -*--===;
+;===- ./lib/DebugInfo/Msf/LLVMBuild.txt -------------------*- Conf -*--===;
;
; The LLVM Compiler Infrastructure
;
[component_0]
type = Library
-name = DebugInfoMSF
+name = DebugInfoMsf
parent = DebugInfo
required_libraries = Support
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/IMSFFile.h"
-#include "llvm/DebugInfo/MSF/MSFCommon.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
-#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
+#include "llvm/DebugInfo/Msf/IMsfFile.h"
+#include "llvm/DebugInfo/Msf/MsfCommon.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
+#include "llvm/DebugInfo/Msf/MsfStreamLayout.h"
using namespace llvm;
using namespace llvm::msf;
}
MappedBlockStream::MappedBlockStream(uint32_t BlockSize, uint32_t NumBlocks,
- const MSFStreamLayout &Layout,
+ const MsfStreamLayout &Layout,
const ReadableStream &MsfData)
: BlockSize(BlockSize), NumBlocks(NumBlocks), StreamLayout(Layout),
MsfData(MsfData) {}
std::unique_ptr<MappedBlockStream>
MappedBlockStream::createStream(uint32_t BlockSize, uint32_t NumBlocks,
- const MSFStreamLayout &Layout,
+ const MsfStreamLayout &Layout,
const ReadableStream &MsfData) {
return llvm::make_unique<MappedBlockStreamImpl<MappedBlockStream>>(
BlockSize, NumBlocks, Layout, MsfData);
}
std::unique_ptr<MappedBlockStream>
-MappedBlockStream::createIndexedStream(const MSFLayout &Layout,
+MappedBlockStream::createIndexedStream(const MsfLayout &Layout,
const ReadableStream &MsfData,
uint32_t StreamIndex) {
- MSFStreamLayout SL;
+ MsfStreamLayout SL;
SL.Blocks = Layout.StreamMap[StreamIndex];
SL.Length = Layout.StreamSizes[StreamIndex];
return llvm::make_unique<MappedBlockStreamImpl<MappedBlockStream>>(
}
std::unique_ptr<MappedBlockStream>
-MappedBlockStream::createDirectoryStream(const MSFLayout &Layout,
+MappedBlockStream::createDirectoryStream(const MsfLayout &Layout,
const ReadableStream &MsfData) {
- MSFStreamLayout SL;
+ MsfStreamLayout SL;
SL.Blocks = Layout.DirectoryBlocks;
SL.Length = Layout.SB->NumDirectoryBytes;
return createStream(Layout.SB->BlockSize, Layout.SB->NumBlocks, SL, MsfData);
ArrayRef<uint8_t> &Buffer) const {
// Make sure we aren't trying to read beyond the end of the stream.
if (Size > StreamLayout.Length)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (Offset > StreamLayout.Length - Size)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (tryReadContiguously(Offset, Size, Buffer))
return Error::success();
uint32_t Offset, ArrayRef<uint8_t> &Buffer) const {
// Make sure we aren't trying to read beyond the end of the stream.
if (Offset >= StreamLayout.Length)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
uint32_t First = Offset / BlockSize;
uint32_t Last = First;
// Make sure we aren't trying to read beyond the end of the stream.
if (Buffer.size() > StreamLayout.Length)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (Offset > StreamLayout.Length - Buffer.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
uint32_t BytesLeft = Buffer.size();
uint32_t BytesWritten = 0;
}
WritableMappedBlockStream::WritableMappedBlockStream(
- uint32_t BlockSize, uint32_t NumBlocks, const MSFStreamLayout &Layout,
+ uint32_t BlockSize, uint32_t NumBlocks, const MsfStreamLayout &Layout,
const WritableStream &MsfData)
: ReadInterface(BlockSize, NumBlocks, Layout, MsfData),
WriteInterface(MsfData) {}
std::unique_ptr<WritableMappedBlockStream>
WritableMappedBlockStream::createStream(uint32_t BlockSize, uint32_t NumBlocks,
- const MSFStreamLayout &Layout,
+ const MsfStreamLayout &Layout,
const WritableStream &MsfData) {
return llvm::make_unique<MappedBlockStreamImpl<WritableMappedBlockStream>>(
BlockSize, NumBlocks, Layout, MsfData);
}
std::unique_ptr<WritableMappedBlockStream>
-WritableMappedBlockStream::createIndexedStream(const MSFLayout &Layout,
+WritableMappedBlockStream::createIndexedStream(const MsfLayout &Layout,
const WritableStream &MsfData,
uint32_t StreamIndex) {
- MSFStreamLayout SL;
+ MsfStreamLayout SL;
SL.Blocks = Layout.StreamMap[StreamIndex];
SL.Length = Layout.StreamSizes[StreamIndex];
return createStream(Layout.SB->BlockSize, Layout.SB->NumBlocks, SL, MsfData);
std::unique_ptr<WritableMappedBlockStream>
WritableMappedBlockStream::createDirectoryStream(
- const MSFLayout &Layout, const WritableStream &MsfData) {
- MSFStreamLayout SL;
+ const MsfLayout &Layout, const WritableStream &MsfData) {
+ MsfStreamLayout SL;
SL.Blocks = Layout.DirectoryBlocks;
SL.Length = Layout.SB->NumDirectoryBytes;
return createStream(Layout.SB->BlockSize, Layout.SB->NumBlocks, SL, MsfData);
ArrayRef<uint8_t> Buffer) const {
// Make sure we aren't trying to write beyond the end of the stream.
if (Buffer.size() > getStreamLength())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
if (Offset > getStreamLayout().Length - Buffer.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
uint32_t BlockNum = Offset / getBlockSize();
uint32_t OffsetInBlock = Offset % getBlockSize();
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/MSF/MSFBuilder.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
+#include "llvm/DebugInfo/Msf/MsfBuilder.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
using namespace llvm;
using namespace llvm::msf;
const uint32_t kDefaultBlockMapAddr = kNumReservedPages;
}
-MSFBuilder::MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
+MsfBuilder::MsfBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
BumpPtrAllocator &Allocator)
: Allocator(Allocator), IsGrowable(CanGrow), BlockSize(BlockSize),
MininumBlocks(MinBlockCount), BlockMapAddr(kDefaultBlockMapAddr),
FreeBlocks[BlockMapAddr] = false;
}
-Expected<MSFBuilder> MSFBuilder::create(BumpPtrAllocator &Allocator,
+Expected<MsfBuilder> MsfBuilder::create(BumpPtrAllocator &Allocator,
uint32_t BlockSize,
uint32_t MinBlockCount, bool CanGrow) {
if (!isValidBlockSize(BlockSize))
- return make_error<MSFError>(msf_error_code::invalid_format,
+ return make_error<MsfError>(msf_error_code::invalid_format,
"The requested block size is unsupported");
- return MSFBuilder(BlockSize,
+ return MsfBuilder(BlockSize,
std::max(MinBlockCount, msf::getMinimumBlockCount()),
CanGrow, Allocator);
}
-Error MSFBuilder::setBlockMapAddr(uint32_t Addr) {
+Error MsfBuilder::setBlockMapAddr(uint32_t Addr) {
if (Addr == BlockMapAddr)
return Error::success();
if (Addr >= FreeBlocks.size()) {
if (!IsGrowable)
- return make_error<MSFError>(msf_error_code::insufficient_buffer,
+ return make_error<MsfError>(msf_error_code::insufficient_buffer,
"Cannot grow the number of blocks");
FreeBlocks.resize(Addr + 1);
}
if (!isBlockFree(Addr))
- return make_error<MSFError>(
+ return make_error<MsfError>(
msf_error_code::block_in_use,
"Requested block map address is already in use");
FreeBlocks[BlockMapAddr] = true;
return Error::success();
}
-void MSFBuilder::setFreePageMap(uint32_t Fpm) { FreePageMap = Fpm; }
+void MsfBuilder::setFreePageMap(uint32_t Fpm) { FreePageMap = Fpm; }
-void MSFBuilder::setUnknown1(uint32_t Unk1) { Unknown1 = Unk1; }
+void MsfBuilder::setUnknown1(uint32_t Unk1) { Unknown1 = Unk1; }
-Error MSFBuilder::setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks) {
+Error MsfBuilder::setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks) {
for (auto B : DirectoryBlocks)
FreeBlocks[B] = true;
for (auto B : DirBlocks) {
if (!isBlockFree(B)) {
- return make_error<MSFError>(msf_error_code::unspecified,
+ return make_error<MsfError>(msf_error_code::unspecified,
"Attempt to reuse an allocated block");
}
FreeBlocks[B] = false;
return Error::success();
}
-Error MSFBuilder::allocateBlocks(uint32_t NumBlocks,
+Error MsfBuilder::allocateBlocks(uint32_t NumBlocks,
MutableArrayRef<uint32_t> Blocks) {
if (NumBlocks == 0)
return Error::success();
uint32_t NumFreeBlocks = FreeBlocks.count();
if (NumFreeBlocks < NumBlocks) {
if (!IsGrowable)
- return make_error<MSFError>(msf_error_code::insufficient_buffer,
+ return make_error<MsfError>(msf_error_code::insufficient_buffer,
"There are no free Blocks in the file");
uint32_t AllocBlocks = NumBlocks - NumFreeBlocks;
FreeBlocks.resize(AllocBlocks + FreeBlocks.size(), true);
return Error::success();
}
-uint32_t MSFBuilder::getNumUsedBlocks() const {
+uint32_t MsfBuilder::getNumUsedBlocks() const {
return getTotalBlockCount() - getNumFreeBlocks();
}
-uint32_t MSFBuilder::getNumFreeBlocks() const { return FreeBlocks.count(); }
+uint32_t MsfBuilder::getNumFreeBlocks() const { return FreeBlocks.count(); }
-uint32_t MSFBuilder::getTotalBlockCount() const { return FreeBlocks.size(); }
+uint32_t MsfBuilder::getTotalBlockCount() const { return FreeBlocks.size(); }
-bool MSFBuilder::isBlockFree(uint32_t Idx) const { return FreeBlocks[Idx]; }
+bool MsfBuilder::isBlockFree(uint32_t Idx) const { return FreeBlocks[Idx]; }
-Error MSFBuilder::addStream(uint32_t Size, ArrayRef<uint32_t> Blocks) {
+Error MsfBuilder::addStream(uint32_t Size, ArrayRef<uint32_t> Blocks) {
// Add a new stream mapped to the specified blocks. Verify that the specified
// blocks are both necessary and sufficient for holding the requested number
// of bytes, and verify that all requested blocks are free.
uint32_t ReqBlocks = bytesToBlocks(Size, BlockSize);
if (ReqBlocks != Blocks.size())
- return make_error<MSFError>(
+ return make_error<MsfError>(
msf_error_code::invalid_format,
"Incorrect number of blocks for requested stream size");
for (auto Block : Blocks) {
FreeBlocks.resize(Block + 1, true);
if (!FreeBlocks.test(Block))
- return make_error<MSFError>(
+ return make_error<MsfError>(
msf_error_code::unspecified,
"Attempt to re-use an already allocated block");
}
return Error::success();
}
-Error MSFBuilder::addStream(uint32_t Size) {
+Error MsfBuilder::addStream(uint32_t Size) {
uint32_t ReqBlocks = bytesToBlocks(Size, BlockSize);
std::vector<uint32_t> NewBlocks;
NewBlocks.resize(ReqBlocks);
return Error::success();
}
-Error MSFBuilder::setStreamSize(uint32_t Idx, uint32_t Size) {
+Error MsfBuilder::setStreamSize(uint32_t Idx, uint32_t Size) {
uint32_t OldSize = getStreamSize(Idx);
if (OldSize == Size)
return Error::success();
return Error::success();
}
-uint32_t MSFBuilder::getNumStreams() const { return StreamData.size(); }
+uint32_t MsfBuilder::getNumStreams() const { return StreamData.size(); }
-uint32_t MSFBuilder::getStreamSize(uint32_t StreamIdx) const {
+uint32_t MsfBuilder::getStreamSize(uint32_t StreamIdx) const {
return StreamData[StreamIdx].first;
}
-ArrayRef<uint32_t> MSFBuilder::getStreamBlocks(uint32_t StreamIdx) const {
+ArrayRef<uint32_t> MsfBuilder::getStreamBlocks(uint32_t StreamIdx) const {
return StreamData[StreamIdx].second;
}
-uint32_t MSFBuilder::computeDirectoryByteSize() const {
+uint32_t MsfBuilder::computeDirectoryByteSize() const {
// The directory has the following layout, where each item is a ulittle32_t:
// NumStreams
// StreamSizes[NumStreams]
return Size;
}
-Expected<MSFLayout> MSFBuilder::build() {
+Expected<MsfLayout> MsfBuilder::build() {
SuperBlock *SB = Allocator.Allocate<SuperBlock>();
- MSFLayout L;
+ MsfLayout L;
L.SB = SB;
std::memcpy(SB->MagicBytes, Magic, sizeof(Magic));
-//===- MSFCommon.cpp - Common types and functions for MSF files -*- C++ -*-===//
+//===- MsfCommon.cpp - Common types and functions for MSF files -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/MSF/MSFCommon.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
+#include "llvm/DebugInfo/Msf/MsfCommon.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
using namespace llvm;
using namespace llvm::msf;
Error llvm::msf::validateSuperBlock(const SuperBlock &SB) {
// Check the magic bytes.
if (std::memcmp(SB.MagicBytes, Magic, sizeof(Magic)) != 0)
- return make_error<MSFError>(msf_error_code::invalid_format,
+ return make_error<MsfError>(msf_error_code::invalid_format,
"MSF magic header doesn't match");
if (!isValidBlockSize(SB.BlockSize))
- return make_error<MSFError>(msf_error_code::invalid_format,
+ return make_error<MsfError>(msf_error_code::invalid_format,
"Unsupported block size.");
// We don't support directories whose sizes aren't a multiple of four bytes.
if (SB.NumDirectoryBytes % sizeof(support::ulittle32_t) != 0)
- return make_error<MSFError>(msf_error_code::invalid_format,
+ return make_error<MsfError>(msf_error_code::invalid_format,
"Directory size is not multiple of 4.");
// The number of blocks which comprise the directory is a simple function of
// block numbers. It is unclear what would happen if the number of blocks
// couldn't fit on a single block.
if (NumDirectoryBlocks > SB.BlockSize / sizeof(support::ulittle32_t))
- return make_error<MSFError>(msf_error_code::invalid_format,
+ return make_error<MsfError>(msf_error_code::invalid_format,
"Too many directory blocks.");
if (SB.BlockMapAddr == 0)
- return make_error<MSFError>(msf_error_code::invalid_format,
+ return make_error<MsfError>(msf_error_code::invalid_format,
"Block 0 is reserved");
return Error::success();
-//===- MSFError.cpp - Error extensions for MSF files ------------*- C++ -*-===//
+//===- MsfError.cpp - Error extensions for Msf files ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/MSF/MSFError.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
// FIXME: This class is only here to support the transition to llvm::Error. It
// will be removed once this transition is complete. Clients should prefer to
// deal with the Error value directly, rather than converting to error_code.
-class MSFErrorCategory : public std::error_category {
+class MsfErrorCategory : public std::error_category {
public:
const char *name() const LLVM_NOEXCEPT override { return "llvm.msf"; }
};
} // end anonymous namespace
-static ManagedStatic<MSFErrorCategory> Category;
+static ManagedStatic<MsfErrorCategory> Category;
-char MSFError::ID = 0;
+char MsfError::ID = 0;
-MSFError::MSFError(msf_error_code C) : MSFError(C, "") {}
+MsfError::MsfError(msf_error_code C) : MsfError(C, "") {}
-MSFError::MSFError(const std::string &Context)
- : MSFError(msf_error_code::unspecified, Context) {}
+MsfError::MsfError(const std::string &Context)
+ : MsfError(msf_error_code::unspecified, Context) {}
-MSFError::MSFError(msf_error_code C, const std::string &Context) : Code(C) {
- ErrMsg = "MSF Error: ";
+MsfError::MsfError(msf_error_code C, const std::string &Context) : Code(C) {
+ ErrMsg = "Msf Error: ";
std::error_code EC = convertToErrorCode();
if (Code != msf_error_code::unspecified)
ErrMsg += EC.message() + " ";
ErrMsg += Context;
}
-void MSFError::log(raw_ostream &OS) const { OS << ErrMsg << "\n"; }
+void MsfError::log(raw_ostream &OS) const { OS << ErrMsg << "\n"; }
-const std::string &MSFError::getErrorMessage() const { return ErrMsg; }
+const std::string &MsfError::getErrorMessage() const { return ErrMsg; }
-std::error_code MSFError::convertToErrorCode() const {
+std::error_code MsfError::convertToErrorCode() const {
return std::error_code(static_cast<int>(Code), *Category);
}
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
using namespace llvm;
using namespace llvm::msf;
Error StreamReader::readStreamRef(ReadableStreamRef &Ref, uint32_t Length) {
if (bytesRemaining() < Length)
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
Ref = Stream.slice(Offset, Length);
Offset += Length;
return Error::success();
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
-#include "llvm/DebugInfo/MSF/MSFError.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
+#include "llvm/DebugInfo/Msf/MsfError.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
using namespace llvm;
using namespace llvm::msf;
type = Library
name = DebugInfoPDB
parent = DebugInfo
-required_libraries = Object Support DebugInfoCodeView DebugInfoMSF
+required_libraries = Object Support DebugInfoCodeView DebugInfoMsf
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
return std::move(Dbi);
}
-Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
+Error DbiStreamBuilder::commit(const msf::MsfLayout &Layout,
const msf::WritableStream &Buffer) const {
auto InfoS =
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamDBI);
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
return std::move(Info);
}
-Error InfoStreamBuilder::commit(const msf::MSFLayout &Layout,
+Error InfoStreamBuilder::commit(const msf::MsfLayout &Layout,
const msf::WritableStream &Buffer) const {
auto InfoS =
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamPDB);
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/Support/Endian.h"
#include "llvm/DebugInfo/PDB/Raw/ModStream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/Hash.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/Support/Endian.h"
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
#include "llvm/ADT/SparseBitVector.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
using namespace llvm;
#include "llvm/DebugInfo/PDB/Raw/NameMapBuilder.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
#include "llvm/Support/Endian.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/StreamArray.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
#include "llvm/ADT/BitVector.h"
-#include "llvm/DebugInfo/MSF/MSFBuilder.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/MsfBuilder.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
Error PDBFileBuilder::initialize(const msf::SuperBlock &Super) {
auto ExpectedMsf =
- MSFBuilder::create(Allocator, Super.BlockSize, Super.NumBlocks);
+ MsfBuilder::create(Allocator, Super.BlockSize, Super.NumBlocks);
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 = llvm::make_unique<MsfBuilder>(std::move(MsfResult));
Msf->setFreePageMap(Super.FreeBlockMapBlock);
Msf->setUnknown1(Super.Unknown1);
return Error::success();
}
-MSFBuilder &PDBFileBuilder::getMsfBuilder() { return *Msf; }
+MsfBuilder &PDBFileBuilder::getMsfBuilder() { return *Msf; }
InfoStreamBuilder &PDBFileBuilder::getInfoBuilder() {
if (!Info)
return *Dbi;
}
-Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() const {
+Expected<msf::MsfLayout> PDBFileBuilder::finalizeMsfLayout() const {
if (Info) {
uint32_t Length = Info->calculateSerializedLength();
if (auto EC = Msf->setStreamSize(StreamPDB, Length))
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/DebugInfo/PDB/Raw/RawSession.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
+#include "llvm/DebugInfo/Msf/ByteStream.h"
+#include "llvm/DebugInfo/Msf/StreamInterface.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/Hash.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
set(LLVM_LINK_COMPONENTS
DebugInfoCodeView
- DebugInfoMSF
+ DebugInfoMsf
DebugInfoPDB
Object
Support
type = Tool
name = llvm-pdbdump
parent = Tools
-required_libraries = DebugInfoMSF DebugInfoPDB
+required_libraries = DebugInfoMsf DebugInfoPDB
#include "llvm/DebugInfo/CodeView/EnumTables.h"
#include "llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h"
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/EnumTables.h"
IO.mapOptional("DbiStream", Obj.DbiStream);
}
-void MappingTraits<MSFHeaders>::mapping(IO &IO, MSFHeaders &Obj) {
+void MappingTraits<MsfHeaders>::mapping(IO &IO, MsfHeaders &Obj) {
IO.mapRequired("SuperBlock", Obj.SuperBlock);
IO.mapRequired("NumDirectoryBlocks", Obj.NumDirectoryBlocks);
IO.mapRequired("DirectoryBlocks", Obj.DirectoryBlocks);
#include "OutputStyle.h"
#include "llvm/ADT/Optional.h"
-#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/Msf/MsfCommon.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
namespace pdb {
namespace yaml {
-struct MSFHeaders {
+struct MsfHeaders {
msf::SuperBlock SuperBlock;
uint32_t NumDirectoryBlocks;
std::vector<uint32_t> DirectoryBlocks;
};
struct PdbObject {
- Optional<MSFHeaders> Headers;
+ Optional<MsfHeaders> Headers;
Optional<std::vector<uint32_t>> StreamSizes;
Optional<std::vector<StreamBlockList>> StreamMap;
Optional<PdbInfoStream> PdbStream;
static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
};
-template <> struct MappingTraits<pdb::yaml::MSFHeaders> {
- static void mapping(IO &IO, pdb::yaml::MSFHeaders &Obj);
+template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
+ static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
};
template <> struct MappingTraits<msf::SuperBlock> {
if (opts::pdb2yaml::NoFileHeaders)
return Error::success();
- yaml::MSFHeaders Headers;
+ yaml::MsfHeaders Headers;
Obj.Headers.emplace();
Obj.Headers->SuperBlock.NumBlocks = File.getBlockCount();
Obj.Headers->SuperBlock.BlockMapAddr = File.getBlockMapIndex();
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Config/config.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
-#include "llvm/DebugInfo/MSF/MSFBuilder.h"
+#include "llvm/DebugInfo/Msf/ByteStream.h"
+#include "llvm/DebugInfo/Msf/MsfBuilder.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
Object
Support
DebugInfoCodeView
- DebugInfoMSF
+ DebugInfoMsf
)
add_llvm_tool(llvm-readobj
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
+#include "llvm/DebugInfo/Msf/ByteStream.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/COFF.h"
type = Tool
name = llvm-readobj
parent = Tools
-required_libraries = all-targets BitReader Object DebugInfoCodeView DebugInfoMSF
+required_libraries = all-targets BitReader Object DebugInfoCodeView DebugInfoMsf
set(LLVM_LINK_COMPONENTS
DebugInfoCodeView
- DebugInfoMSF
+ DebugInfoMsf
DebugInfoPDB
)
set(DebugInfoPDBSources
MappedBlockStreamTest.cpp
- MSFBuilderTest.cpp
+ MsfBuilderTest.cpp
PDBApiTest.cpp
)
#include "ErrorChecking.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
-#include "llvm/DebugInfo/MSF/IMSFFile.h"
-#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
-#include "llvm/DebugInfo/MSF/StreamReader.h"
-#include "llvm/DebugInfo/MSF/StreamRef.h"
-#include "llvm/DebugInfo/MSF/StreamWriter.h"
+#include "llvm/DebugInfo/Msf/ByteStream.h"
+#include "llvm/DebugInfo/Msf/IMsfFile.h"
+#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
+#include "llvm/DebugInfo/Msf/MsfStreamLayout.h"
+#include "llvm/DebugInfo/Msf/StreamReader.h"
+#include "llvm/DebugInfo/Msf/StreamRef.h"
+#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "gtest/gtest.h"
#include <unordered_map>
Error readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) const override {
if (Offset + Size > Data.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
Buffer = Data.slice(Offset, Size);
return Error::success();
}
Error readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) const override {
if (Offset >= Data.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
Buffer = Data.drop_front(Offset);
return Error::success();
}
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> SrcData) const override {
if (Offset + SrcData.size() > Data.size())
- return make_error<MSFError>(msf_error_code::insufficient_buffer);
+ return make_error<MsfError>(msf_error_code::insufficient_buffer);
::memcpy(&Data[Offset], SrcData.data(), SrcData.size());
return Error::success();
}
Error commit() const override { return Error::success(); }
- MSFStreamLayout layout() const {
- return MSFStreamLayout{static_cast<uint32_t>(Data.size()), Blocks};
+ MsfStreamLayout layout() const {
+ return MsfStreamLayout{static_cast<uint32_t>(Data.size()), Blocks};
}
private:
-//===- MSFBuilderTest.cpp Tests manipulation of MSF stream metadata ------===//
+//===- MsfBuilderTest.cpp Tests manipulation of MSF stream metadata ------===//
//
// The LLVM Compiler Infrastructure
//
#include "ErrorChecking.h"
-#include "llvm/DebugInfo/MSF/MSFBuilder.h"
-#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/Msf/MsfBuilder.h"
+#include "llvm/DebugInfo/Msf/MsfCommon.h"
#include "gtest/gtest.h"
using namespace llvm::msf;
namespace {
-class MSFBuilderTest : public testing::Test {
+class MsfBuilderTest : public testing::Test {
protected:
void initializeSimpleSuperBlock(msf::SuperBlock &SB) {
initializeSuperBlock(SB);
};
}
-TEST_F(MSFBuilderTest, ValidateSuperBlockAccept) {
+TEST_F(MsfBuilderTest, ValidateSuperBlockAccept) {
// Test that a known good super block passes validation.
SuperBlock SB;
initializeSuperBlock(SB);
EXPECT_NO_ERROR(msf::validateSuperBlock(SB));
}
-TEST_F(MSFBuilderTest, ValidateSuperBlockReject) {
+TEST_F(MsfBuilderTest, ValidateSuperBlockReject) {
// Test that various known problems cause a super block to be rejected.
SuperBlock SB;
initializeSimpleSuperBlock(SB);
EXPECT_ERROR(msf::validateSuperBlock(SB));
}
-TEST_F(MSFBuilderTest, TestUsedBlocksMarkedAsUsed) {
+TEST_F(MsfBuilderTest, TestUsedBlocksMarkedAsUsed) {
// Test that when assigning a stream to a known list of blocks, the blocks
// are correctly marked as used after adding, but no other incorrect blocks
// are accidentally marked as used.
// Allocate some extra blocks at the end so we can verify that they're free
// after the initialization.
uint32_t NumBlocks = msf::getMinimumBlockCount() + Blocks.size() + 10;
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096, NumBlocks);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096, NumBlocks);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
}
}
-TEST_F(MSFBuilderTest, TestAddStreamNoDirectoryBlockIncrease) {
+TEST_F(MsfBuilderTest, TestAddStreamNoDirectoryBlockIncrease) {
// Test that adding a new stream correctly updates the directory. This only
// tests the case where the directory *DOES NOT* grow large enough that it
// crosses a Block boundary.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
auto ExpectedL1 = Msf.build();
EXPECT_EXPECTED(ExpectedL1);
- MSFLayout &L1 = *ExpectedL1;
+ MsfLayout &L1 = *ExpectedL1;
auto OldDirBlocks = L1.DirectoryBlocks;
EXPECT_EQ(1U, OldDirBlocks.size());
- auto ExpectedMsf2 = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf2 = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf2);
auto &Msf2 = *ExpectedMsf2;
auto ExpectedL2 = Msf2.build();
EXPECT_EXPECTED(ExpectedL2);
- MSFLayout &L2 = *ExpectedL2;
+ MsfLayout &L2 = *ExpectedL2;
auto NewDirBlocks = L2.DirectoryBlocks;
EXPECT_EQ(1U, NewDirBlocks.size());
}
-TEST_F(MSFBuilderTest, TestAddStreamWithDirectoryBlockIncrease) {
+TEST_F(MsfBuilderTest, TestAddStreamWithDirectoryBlockIncrease) {
// Test that adding a new stream correctly updates the directory. This only
// tests the case where the directory *DOES* grow large enough that it
// crosses a Block boundary. This is because the newly added stream occupies
// so many Blocks that need to be indexed in the directory that the directory
// crosses a Block boundary.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
auto ExpectedL1 = Msf.build();
EXPECT_EXPECTED(ExpectedL1);
- MSFLayout &L1 = *ExpectedL1;
+ MsfLayout &L1 = *ExpectedL1;
auto DirBlocks = L1.DirectoryBlocks;
EXPECT_EQ(2U, DirBlocks.size());
}
-TEST_F(MSFBuilderTest, TestGrowStreamNoBlockIncrease) {
+TEST_F(MsfBuilderTest, TestGrowStreamNoBlockIncrease) {
// Test growing an existing stream by a value that does not affect the number
// of blocks it occupies.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
EXPECT_EQ(OldStreamBlocks, NewStreamBlocks);
}
-TEST_F(MSFBuilderTest, TestGrowStreamWithBlockIncrease) {
+TEST_F(MsfBuilderTest, TestGrowStreamWithBlockIncrease) {
// Test that growing an existing stream to a value large enough that it causes
// the need to allocate new Blocks to the stream correctly updates the
// stream's
// block list.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
EXPECT_NE(NewStreamBlocks[0], NewStreamBlocks[1]);
}
-TEST_F(MSFBuilderTest, TestShrinkStreamNoBlockDecrease) {
+TEST_F(MsfBuilderTest, TestShrinkStreamNoBlockDecrease) {
// Test that shrinking an existing stream by a value that does not affect the
// number of Blocks it occupies makes no changes to stream's block list.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
EXPECT_EQ(OldStreamBlocks, NewStreamBlocks);
}
-TEST_F(MSFBuilderTest, TestShrinkStreamWithBlockDecrease) {
+TEST_F(MsfBuilderTest, TestShrinkStreamWithBlockDecrease) {
// Test that shrinking an existing stream to a value large enough that it
// causes the need to deallocate new Blocks to the stream correctly updates
// the stream's block list.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
EXPECT_EQ(OldStreamBlocks[0], NewStreamBlocks[0]);
}
-TEST_F(MSFBuilderTest, TestRejectReusedStreamBlock) {
+TEST_F(MsfBuilderTest, TestRejectReusedStreamBlock) {
// Test that attempting to add a stream and assigning a block that is already
// in use by another stream fails.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
EXPECT_ERROR(Msf.addStream(6144, Blocks));
}
-TEST_F(MSFBuilderTest, TestBlockCountsWhenAddingStreams) {
+TEST_F(MsfBuilderTest, TestBlockCountsWhenAddingStreams) {
// Test that when adding multiple streams, the number of used and free Blocks
// allocated to the MSF file are as expected.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
}
}
-TEST_F(MSFBuilderTest, BuildMsfLayout) {
- // Test that we can generate an MSFLayout structure from a valid layout
+TEST_F(MsfBuilderTest, BuildMsfLayout) {
+ // Test that we can generate an Msf MsfLayout structure from a valid layout
// specification.
- auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
+ auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
auto ExpectedLayout = Msf.build();
EXPECT_EXPECTED(ExpectedLayout);
- MSFLayout &L = *ExpectedLayout;
+ MsfLayout &L = *ExpectedLayout;
EXPECT_EQ(4096U, L.SB->BlockSize);
EXPECT_EQ(ExpectedNumBlocks, L.SB->NumBlocks);
}
}
-TEST_F(MSFBuilderTest, UseDirectoryBlockHint) {
- Expected<MSFBuilder> ExpectedMsf = MSFBuilder::create(
+TEST_F(MsfBuilderTest, UseDirectoryBlockHint) {
+ Expected<MsfBuilder> ExpectedMsf = MsfBuilder::create(
Allocator, 4096, msf::getMinimumBlockCount() + 1, false);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
auto ExpectedLayout = Msf.build();
EXPECT_EXPECTED(ExpectedLayout);
- MSFLayout &L = *ExpectedLayout;
+ MsfLayout &L = *ExpectedLayout;
EXPECT_EQ(msf::getMinimumBlockCount() + 2, L.SB->NumBlocks);
EXPECT_EQ(1U, L.DirectoryBlocks.size());
EXPECT_EQ(1U, L.StreamMap[0].size());
EXPECT_EQ(B + 2, L.StreamMap[0].front());
}
-TEST_F(MSFBuilderTest, DirectoryBlockHintInsufficient) {
- Expected<MSFBuilder> ExpectedMsf =
- MSFBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
+TEST_F(MsfBuilderTest, DirectoryBlockHintInsufficient) {
+ Expected<MsfBuilder> ExpectedMsf =
+ MsfBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
uint32_t B = msf::getFirstUnreservedBlock();
auto ExpectedLayout = Msf.build();
EXPECT_EXPECTED(ExpectedLayout);
- MSFLayout &L = *ExpectedLayout;
+ MsfLayout &L = *ExpectedLayout;
EXPECT_EQ(2U, L.DirectoryBlocks.size());
EXPECT_EQ(B + 1, L.DirectoryBlocks[0]);
}
-TEST_F(MSFBuilderTest, DirectoryBlockHintOverestimated) {
- Expected<MSFBuilder> ExpectedMsf =
- MSFBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
+TEST_F(MsfBuilderTest, DirectoryBlockHintOverestimated) {
+ Expected<MsfBuilder> ExpectedMsf =
+ MsfBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
EXPECT_EXPECTED(ExpectedMsf);
auto &Msf = *ExpectedMsf;
auto ExpectedLayout = Msf.build();
EXPECT_EXPECTED(ExpectedLayout);
- MSFLayout &L = *ExpectedLayout;
+ MsfLayout &L = *ExpectedLayout;
EXPECT_EQ(1U, L.DirectoryBlocks.size());
EXPECT_EQ(B + 1, L.DirectoryBlocks[0]);
}