LLVM  15.0.0git
NamedStreamMap.h
Go to the documentation of this file.
1 //===- NamedStreamMap.h - PDB Named Stream Map ------------------*- 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_NAMEDSTREAMMAP_H
10 #define LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
11 
12 #include "llvm/ADT/StringMap.h"
13 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/Error.h"
16 #include <cstdint>
17 
18 namespace llvm {
19 
20 class BinaryStreamReader;
21 class BinaryStreamWriter;
22 
23 namespace pdb {
24 
25 class NamedStreamMap;
26 
29 
34 };
35 
37  friend class NamedStreamMapBuilder;
38 
39 public:
41 
42  Error load(BinaryStreamReader &Stream);
43  Error commit(BinaryStreamWriter &Writer) const;
45 
46  uint32_t size() const;
47  bool get(StringRef Stream, uint32_t &StreamNo) const;
48  void set(StringRef Stream, uint32_t StreamNo);
49 
53 
55 
56 private:
57  NamedStreamMapTraits HashTraits;
58  /// Closed hash table from Offset -> StreamNumber, where Offset is the offset
59  /// of the stream name in NamesBuffer.
60  HashTable<support::ulittle32_t> OffsetIndexMap;
61 
62  /// Buffer of string data.
63  std::vector<char> NamesBuffer;
64 };
65 
66 } // end namespace pdb
67 
68 } // end namespace llvm
69 
70 #endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
llvm::pdb::NamedStreamMap::set
void set(StringRef Stream, uint32_t StreamNo)
Definition: NamedStreamMap.cpp:122
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::pdb::NamedStreamMapTraits::storageKeyToLookupKey
StringRef storageKeyToLookupKey(uint32_t Offset) const
Definition: NamedStreamMap.cpp:39
llvm::pdb::NamedStreamMap::size
uint32_t size() const
Definition: NamedStreamMap.cpp:87
StringRef.h
llvm::pdb::NamedStreamMap::appendStringData
uint32_t appendStringData(StringRef S)
Definition: NamedStreamMap.cpp:115
llvm::BinaryStreamWriter
Provides write only access to a subclass of WritableBinaryStream.
Definition: BinaryStreamWriter.h:30
llvm::pdb::NamedStreamMap::entries
StringMap< uint32_t > entries() const
Definition: NamedStreamMap.cpp:106
Error.h
HashTable.h
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
llvm::pdb::NamedStreamMap::NamedStreamMapBuilder
friend class NamedStreamMapBuilder
Definition: NamedStreamMap.h:37
llvm::pdb::NamedStreamMap::calculateSerializedLength
uint32_t calculateSerializedLength() const
Definition: NamedStreamMap.cpp:81
llvm::pdb::NamedStreamMapTraits::lookupKeyToStorageKey
uint32_t lookupKeyToStorageKey(StringRef S)
Definition: NamedStreamMap.cpp:43
llvm::pdb::NamedStreamMap::NamedStreamMap
NamedStreamMap()
Definition: NamedStreamMap.cpp:47
llvm::pdb::NamedStreamMapTraits::NamedStreamMapTraits
NamedStreamMapTraits(NamedStreamMap &NS)
Definition: NamedStreamMap.cpp:27
llvm::pdb::NamedStreamMap::getString
StringRef getString(uint32_t Offset) const
Definition: NamedStreamMap.cpp:89
StringMap.h
llvm::StringMap< uint32_t >
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:29
llvm::pdb::NamedStreamMap::commit
Error commit(BinaryStreamWriter &Writer) const
Definition: NamedStreamMap.cpp:64
llvm::pdb::NamedStreamMap::hashString
uint32_t hashString(uint32_t Offset) const
Definition: NamedStreamMap.cpp:94
llvm::pdb::NamedStreamMap::load
Error load(BinaryStreamReader &Stream)
Definition: NamedStreamMap.cpp:49
llvm::pdb::NamedStreamMap::get
bool get(StringRef Stream, uint32_t &StreamNo) const
Definition: NamedStreamMap.cpp:98
llvm::pdb::NamedStreamMap
Definition: NamedStreamMap.h:36
llvm::pdb::NamedStreamMapTraits::NS
NamedStreamMap * NS
Definition: NamedStreamMap.h:28
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
uint32_t
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::pdb::NamedStreamMapTraits::hashLookupKey
uint16_t hashLookupKey(StringRef S) const
Definition: NamedStreamMap.cpp:29
llvm::pdb::HashTable
Definition: HashTable.h:31
llvm::pdb::NamedStreamMapTraits
Definition: NamedStreamMap.h:27