diff options
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h | 37 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/InfoStream.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h | 13 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/ModStream.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h | 6 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/TpiStream.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/Support/Error.h | 1 |
9 files changed, 60 insertions, 17 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h index 525aa7e3fa8..51aaf3d0973 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h @@ -36,7 +36,7 @@ class DbiStream { struct HeaderInfo; public: - DbiStream(PDBFile &File); + DbiStream(PDBFile &File, std::unique_ptr<MappedBlockStream> Stream); ~DbiStream(); Error reload(); @@ -79,7 +79,7 @@ private: Error initializeFpoRecords(); PDBFile &Pdb; - MappedBlockStream Stream; + std::unique_ptr<MappedBlockStream> Stream; std::vector<ModuleInfoEx> ModuleInfos; NameHashTable ECNames; diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h b/llvm/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h new file mode 100644 index 00000000000..0f354315122 --- /dev/null +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h @@ -0,0 +1,37 @@ +//===- DirectoryStreamData.h ---------------------------------- *- C++ --*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_RAW_DIRECTORYSTREAMDATA_H +#define LLVM_DEBUGINFO_PDB_RAW_DIRECTORYSTREAMDATA_H + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h" +#include "llvm/DebugInfo/PDB/Raw/PDBFile.h" +#include "llvm/Support/Endian.h" + +namespace llvm { +namespace pdb { +class IPDBFile; + +class DirectoryStreamData : public IPDBStreamData { +public: + DirectoryStreamData(const PDBFile &File) : File(File) {} + + virtual uint32_t getLength() { return File.getNumDirectoryBytes(); } + virtual llvm::ArrayRef<llvm::support::ulittle32_t> getStreamBlocks() { + return File.getDirectoryBlockArray(); + } + +private: + const PDBFile &File; +}; +} +} + +#endif diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/InfoStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/InfoStream.h index 01b0b16e7f8..f590b4c1cc9 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/InfoStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/InfoStream.h @@ -24,7 +24,7 @@ namespace pdb { class PDBFile; class InfoStream { public: - InfoStream(const PDBFile &File); + InfoStream(std::unique_ptr<MappedBlockStream> Stream); Error reload(); @@ -37,7 +37,7 @@ public: iterator_range<StringMapConstIterator<uint32_t>> named_streams() const; private: - MappedBlockStream Stream; + std::unique_ptr<MappedBlockStream> Stream; // PDB file format version. We only support VC70. See the enumeration // `PdbRaw_ImplVer` for the other possible values. diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h index ea5d0a147ad..0148ed6086b 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h @@ -12,6 +12,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/DebugInfo/CodeView/StreamInterface.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Endian.h" @@ -24,11 +25,10 @@ namespace pdb { class IPDBFile; class IPDBStreamData; +class PDBFile; class MappedBlockStream : public codeview::StreamInterface { public: - MappedBlockStream(std::unique_ptr<IPDBStreamData> Data, const IPDBFile &File); - Error readBytes(uint32_t Offset, uint32_t Size, ArrayRef<uint8_t> &Buffer) const override; @@ -36,7 +36,14 @@ public: uint32_t getNumBytesCopied() const; -private: + static Expected<std::unique_ptr<MappedBlockStream>> + createIndexedStream(uint32_t StreamIdx, const IPDBFile &File); + static Expected<std::unique_ptr<MappedBlockStream>> + createDirectoryStream(const PDBFile &File); + +protected: + MappedBlockStream(std::unique_ptr<IPDBStreamData> Data, const IPDBFile &File); + Error readBytes(uint32_t Offset, MutableArrayRef<uint8_t> Buffer) const; bool tryReadContiguously(uint32_t Offset, uint32_t Size, ArrayRef<uint8_t> &Buffer) const; diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/ModStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/ModStream.h index 570e513e371..59600ae1657 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/ModStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/ModStream.h @@ -26,7 +26,7 @@ class ModInfo; class ModStream { public: - ModStream(const PDBFile &File, const ModInfo &Module); + ModStream(const ModInfo &Module, std::unique_ptr<MappedBlockStream> Stream); ~ModStream(); Error reload(); @@ -40,7 +40,7 @@ public: private: const ModInfo &Mod; - MappedBlockStream Stream; + std::unique_ptr<MappedBlockStream> Stream; codeview::CVSymbolArray SymbolsSubstream; codeview::StreamRef LinesSubstream; diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h index a46896932d7..6cde1458cdb 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h @@ -29,11 +29,10 @@ class PublicsStream { struct HeaderInfo; public: - PublicsStream(PDBFile &File, uint32_t StreamNum); + PublicsStream(PDBFile &File, std::unique_ptr<MappedBlockStream> Stream); ~PublicsStream(); Error reload(); - uint32_t getStreamNum() const { return StreamNum; } uint32_t getSymHash() const; uint32_t getAddrMap() const; uint32_t getNumBuckets() const { return NumBuckets; } @@ -55,8 +54,7 @@ public: private: PDBFile &Pdb; - uint32_t StreamNum; - MappedBlockStream Stream; + std::unique_ptr<MappedBlockStream> Stream; uint32_t NumBuckets = 0; ArrayRef<uint8_t> Bitmap; codeview::FixedStreamArray<PSHashRecord> HashRecords; diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h index dc43e221786..dcb64865db2 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h @@ -22,7 +22,7 @@ class PDBFile; class SymbolStream { public: - SymbolStream(const PDBFile &File, uint32_t StreamNum); + SymbolStream(std::unique_ptr<MappedBlockStream> Stream); ~SymbolStream(); Error reload(); @@ -31,7 +31,7 @@ public: private: codeview::CVSymbolArray SymbolRecords; - MappedBlockStream MappedStream; + std::unique_ptr<MappedBlockStream> Stream; }; } } diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/TpiStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/TpiStream.h index d6765529371..4a10dd1c453 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/TpiStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/TpiStream.h @@ -31,7 +31,7 @@ class TpiStream { struct HeaderInfo; public: - TpiStream(const PDBFile &File, uint32_t StreamIdx); + TpiStream(const PDBFile &File, std::unique_ptr<MappedBlockStream> Stream); ~TpiStream(); Error reload(); @@ -53,7 +53,7 @@ public: private: const PDBFile &Pdb; - MappedBlockStream Stream; + std::unique_ptr<MappedBlockStream> Stream; HashFunctionType HashFunction; codeview::CVTypeArray TypeRecords; diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 187f34da87d..b817a230d0d 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -614,6 +614,7 @@ template <class T> class Expected { public: typedef typename std::conditional<isRef, wrap, T>::type storage_type; + typedef T value_type; private: typedef typename std::remove_reference<T>::type &reference; |