LLVM  5.0.0
NamedStreamMap.h
Go to the documentation of this file.
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_NATIVE_NAMEDSTREAMMAP_H
11 #define LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
12 
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/StringMap.h"
15 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/Error.h"
19 #include <cstdint>
20 
21 namespace llvm {
22 
23 class BinaryStreamReader;
24 class BinaryStreamWriter;
25 
26 namespace pdb {
27 
29  friend class NamedStreamMapBuilder;
30 
31  struct FinalizationInfo {
32  uint32_t StringDataBytes = 0;
33  uint32_t SerializedLength = 0;
34  };
35 
36 public:
38 
39  Error load(BinaryStreamReader &Stream);
40  Error commit(BinaryStreamWriter &Writer) const;
42 
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; }
49 
50 private:
51  Optional<FinalizationInfo> FinalizedInfo;
52  HashTable FinalizedHashTable;
53  StringMap<uint32_t> Mapping;
54 };
55 
56 } // end namespace pdb
57 
58 } // end namespace llvm
59 
60 #endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
void set(StringRef Stream, uint32_t StreamNo)
const StringMap< uint32_t > & getStringMap() const
Error load(BinaryStreamReader &Stream)
friend class NamedStreamMapBuilder
iterator_range< StringMapConstIterator< uint32_t > > entries() const
Provides write only access to a subclass of WritableBinaryStream.
A range adaptor for a pair of iterators.
Error commit(BinaryStreamWriter &Writer) const
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49