1 //===- InfoStream.h - PDB Info Stream (Stream 1) Access ---------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_INFOSTREAM_H 10 #define LLVM_DEBUGINFO_PDB_NATIVE_INFOSTREAM_H 11 12 #include "llvm/ADT/StringMap.h" 13 #include "llvm/DebugInfo/CodeView/GUID.h" 14 #include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h" 15 #include "llvm/DebugInfo/PDB/Native/RawConstants.h" 16 #include "llvm/Support/BinaryStream.h" 17 #include "llvm/Support/BinaryStreamRef.h" 18 #include "llvm/Support/Compiler.h" 19 20 #include "llvm/Support/Error.h" 21 22 namespace llvm { 23 namespace pdb { 24 struct InfoStreamHeader; 25 class InfoStream { 26 friend class InfoStreamBuilder; 27 28 public: 29 LLVM_ABI InfoStream(std::unique_ptr<BinaryStream> Stream); 30 31 LLVM_ABI Error reload(); 32 33 LLVM_ABI uint32_t getStreamSize() const; 34 getHeader()35 const InfoStreamHeader *getHeader() const { return Header; } 36 37 LLVM_ABI bool containsIdStream() const; 38 LLVM_ABI PdbRaw_ImplVer getVersion() const; 39 LLVM_ABI uint32_t getSignature() const; 40 LLVM_ABI uint32_t getAge() const; 41 LLVM_ABI codeview::GUID getGuid() const; 42 LLVM_ABI uint32_t getNamedStreamMapByteSize() const; 43 44 LLVM_ABI PdbRaw_Features getFeatures() const; 45 LLVM_ABI ArrayRef<PdbRaw_FeatureSig> getFeatureSignatures() const; 46 47 LLVM_ABI const NamedStreamMap &getNamedStreams() const; 48 49 LLVM_ABI BinarySubstreamRef getNamedStreamsBuffer() const; 50 51 LLVM_ABI Expected<uint32_t> getNamedStreamIndex(llvm::StringRef Name) const; 52 LLVM_ABI StringMap<uint32_t> named_streams() const; 53 54 private: 55 std::unique_ptr<BinaryStream> Stream; 56 57 const InfoStreamHeader *Header; 58 59 BinarySubstreamRef SubNamedStreams; 60 61 std::vector<PdbRaw_FeatureSig> FeatureSignatures; 62 PdbRaw_Features Features = PdbFeatureNone; 63 64 uint32_t NamedStreamMapByteSize = 0; 65 66 NamedStreamMap NamedStreams; 67 }; 68 } 69 } 70 71 #endif 72