Line data Source code
1 : //===- NamedStreamMap.h - PDB Named Stream Map ------------------*- 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_PDBNAMEDSTREAMMAP_H
11 : #define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
12 :
13 : #include "llvm/ADT/StringMap.h"
14 : #include "llvm/ADT/StringRef.h"
15 : #include "llvm/DebugInfo/PDB/Raw/HashTable.h"
16 : #include "llvm/Support/Error.h"
17 : #include <cstdint>
18 :
19 : namespace llvm {
20 : namespace msf {
21 : class StreamReader;
22 : class StreamWriter;
23 : }
24 : namespace pdb {
25 : class NamedStreamMapBuilder;
26 93 : class NamedStreamMap {
27 : struct FinalizationInfo {
28 : uint32_t StringDataBytes = 0;
29 : uint32_t SerializedLength = 0;
30 : };
31 : friend NamedStreamMapBuilder;
32 :
33 : public:
34 : NamedStreamMap();
35 :
36 : Error load(msf::StreamReader &Stream);
37 : Error commit(msf::StreamWriter &Writer) const;
38 : uint32_t finalize();
39 :
40 : bool get(StringRef Stream, uint32_t &StreamNo) const;
41 : void set(StringRef Stream, uint32_t StreamNo);
42 : void remove(StringRef Stream);
43 :
44 : iterator_range<StringMapConstIterator<uint32_t>> entries() const;
45 :
46 : private:
47 : Optional<FinalizationInfo> FinalizedInfo;
48 : HashTable FinalizedHashTable;
49 : StringMap<uint32_t> Mapping;
50 : };
51 :
52 : } // end namespace pdb
53 : } // end namespace llvm
54 :
55 : #endif // LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
|