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 
19 #include "llvm/Support/Error.h"
20 
21 namespace llvm {
22 namespace pdb {
23 struct InfoStreamHeader;
24 class InfoStream {
25   friend class InfoStreamBuilder;
26 
27 public:
28   InfoStream(std::unique_ptr<BinaryStream> Stream);
29 
30   Error reload();
31 
32   uint32_t getStreamSize() const;
33 
getHeader()34   const InfoStreamHeader *getHeader() const { return Header; }
35 
36   bool containsIdStream() const;
37   PdbRaw_ImplVer getVersion() const;
38   uint32_t getSignature() const;
39   uint32_t getAge() const;
40   codeview::GUID getGuid() const;
41   uint32_t getNamedStreamMapByteSize() const;
42 
43   PdbRaw_Features getFeatures() const;
44   ArrayRef<PdbRaw_FeatureSig> getFeatureSignatures() const;
45 
46   const NamedStreamMap &getNamedStreams() const;
47 
48   BinarySubstreamRef getNamedStreamsBuffer() const;
49 
50   Expected<uint32_t> getNamedStreamIndex(llvm::StringRef Name) const;
51   StringMap<uint32_t> named_streams() const;
52 
53 private:
54   std::unique_ptr<BinaryStream> Stream;
55 
56   const InfoStreamHeader *Header;
57 
58   BinarySubstreamRef SubNamedStreams;
59 
60   std::vector<PdbRaw_FeatureSig> FeatureSignatures;
61   PdbRaw_Features Features = PdbFeatureNone;
62 
63   uint32_t NamedStreamMapByteSize = 0;
64 
65   NamedStreamMap NamedStreams;
66 };
67 }
68 }
69 
70 #endif
71