1 //===- InfoStream.h - PDB Info Stream (Stream 1) Access ---------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAM_H 11 #define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAM_H 12 13 #include "llvm/ADT/BitmaskEnum.h" 14 #include "llvm/ADT/StringMap.h" 15 #include "llvm/DebugInfo/CodeView/GUID.h" 16 #include "llvm/DebugInfo/MSF/MappedBlockStream.h" 17 #include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h" 18 #include "llvm/DebugInfo/PDB/Native/RawConstants.h" 19 #include "llvm/DebugInfo/PDB/PDBTypes.h" 20 21 #include "llvm/Support/Endian.h" 22 #include "llvm/Support/Error.h" 23 24 namespace llvm { 25 namespace pdb { 26 class InfoStreamBuilder; 27 class PDBFile; 28 29 class InfoStream { 30 friend class InfoStreamBuilder; 31 32 public: 33 InfoStream(std::unique_ptr<BinaryStream> Stream); 34 35 Error reload(); 36 37 uint32_t getStreamSize() const; 38 getHeader()39 const InfoStreamHeader *getHeader() const { return Header; } 40 41 bool containsIdStream() const; 42 PdbRaw_ImplVer getVersion() const; 43 uint32_t getSignature() const; 44 uint32_t getAge() const; 45 codeview::GUID getGuid() const; 46 uint32_t getNamedStreamMapByteSize() const; 47 48 PdbRaw_Features getFeatures() const; 49 ArrayRef<PdbRaw_FeatureSig> getFeatureSignatures() const; 50 51 const NamedStreamMap &getNamedStreams() const; 52 53 BinarySubstreamRef getNamedStreamsBuffer() const; 54 55 Expected<uint32_t> getNamedStreamIndex(llvm::StringRef Name) const; 56 StringMap<uint32_t> named_streams() const; 57 58 private: 59 std::unique_ptr<BinaryStream> Stream; 60 61 const InfoStreamHeader *Header; 62 63 BinarySubstreamRef SubNamedStreams; 64 65 std::vector<PdbRaw_FeatureSig> FeatureSignatures; 66 PdbRaw_Features Features = PdbFeatureNone; 67 68 uint32_t NamedStreamMapByteSize = 0; 69 70 NamedStreamMap NamedStreams; 71 }; 72 } 73 } 74 75 #endif 76