1 //===- NamedStreamMap.h - PDB Named Stream Map ------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
11 #define LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/StringMap.h"
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/ADT/iterator_range.h"
17 #include "llvm/DebugInfo/PDB/Native/HashTable.h"
18 #include "llvm/Support/Error.h"
23 class BinaryStreamReader;
24 class BinaryStreamWriter;
28 class NamedStreamMap {
29 friend class NamedStreamMapBuilder;
31 struct FinalizationInfo {
32 uint32_t StringDataBytes = 0;
33 uint32_t SerializedLength = 0;
39 Error load(BinaryStreamReader &Stream);
40 Error commit(BinaryStreamWriter &Writer) const;
43 uint32_t size() const;
44 bool get(StringRef Stream, uint32_t &StreamNo) const;
45 void set(StringRef Stream, uint32_t StreamNo);
46 void remove(StringRef Stream);
47 const StringMap<uint32_t> &getStringMap() const { return Mapping; }
48 iterator_range<StringMapConstIterator<uint32_t>> entries() const;
51 Optional<FinalizationInfo> FinalizedInfo;
52 HashTable FinalizedHashTable;
53 StringMap<uint32_t> Mapping;
56 } // end namespace pdb
58 } // end namespace llvm
60 #endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H