LLVM  14.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"
16 #include "llvm/Support/Error.h"
17 #include <cstdint>
18 
19 namespace llvm {
20 
21 class BinaryStreamReader;
22 class BinaryStreamWriter;
23 
24 namespace pdb {
25 
26 class NamedStreamMap;
27 
30 
35 };
36 
38  friend class NamedStreamMapBuilder;
39 
40 public:
42 
43  Error load(BinaryStreamReader &Stream);
44  Error commit(BinaryStreamWriter &Writer) const;
46 
47  uint32_t size() const;
48  bool get(StringRef Stream, uint32_t &StreamNo) const;
49  void set(StringRef Stream, uint32_t StreamNo);
50 
54 
56 
57 private:
58  NamedStreamMapTraits HashTraits;
59  /// Closed hash table from Offset -> StreamNumber, where Offset is the offset
60  /// of the stream name in NamesBuffer.
61  HashTable<support::ulittle32_t> OffsetIndexMap;
62 
63  /// Buffer of string data.
64  std::vector<char> NamesBuffer;
65 };
66 
67 } // end namespace pdb
68 
69 } // end namespace llvm
70 
71 #endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
llvm::pdb::NamedStreamMap::set
void set(StringRef Stream, uint32_t StreamNo)
Definition: NamedStreamMap.cpp:124
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::pdb::NamedStreamMapTraits::storageKeyToLookupKey
StringRef storageKeyToLookupKey(uint32_t Offset) const
Definition: NamedStreamMap.cpp:41
llvm::pdb::NamedStreamMap::size
uint32_t size() const
Definition: NamedStreamMap.cpp:89
StringRef.h
llvm::pdb::NamedStreamMap::appendStringData
uint32_t appendStringData(StringRef S)
Definition: NamedStreamMap.cpp:117
llvm::BinaryStreamWriter
Provides write only access to a subclass of WritableBinaryStream.
Definition: BinaryStreamWriter.h:31
llvm::pdb::NamedStreamMap::entries
StringMap< uint32_t > entries() const
Definition: NamedStreamMap.cpp:108
Error.h
HashTable.h
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::pdb::NamedStreamMap::NamedStreamMapBuilder
friend class NamedStreamMapBuilder
Definition: NamedStreamMap.h:38
llvm::pdb::NamedStreamMap::calculateSerializedLength
uint32_t calculateSerializedLength() const
Definition: NamedStreamMap.cpp:83
llvm::pdb::NamedStreamMapTraits::lookupKeyToStorageKey
uint32_t lookupKeyToStorageKey(StringRef S)
Definition: NamedStreamMap.cpp:45
llvm::pdb::NamedStreamMap::NamedStreamMap
NamedStreamMap()
Definition: NamedStreamMap.cpp:49
llvm::pdb::NamedStreamMapTraits::NamedStreamMapTraits
NamedStreamMapTraits(NamedStreamMap &NS)
Definition: NamedStreamMap.cpp:29
llvm::pdb::NamedStreamMap::getString
StringRef getString(uint32_t Offset) const
Definition: NamedStreamMap.cpp:91
StringMap.h
llvm::StringMap< uint32_t >
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:31
llvm::pdb::NamedStreamMap::commit
Error commit(BinaryStreamWriter &Writer) const
Definition: NamedStreamMap.cpp:66
llvm::pdb::NamedStreamMap::hashString
uint32_t hashString(uint32_t Offset) const
Definition: NamedStreamMap.cpp:96
llvm::pdb::NamedStreamMap::load
Error load(BinaryStreamReader &Stream)
Definition: NamedStreamMap.cpp:51
llvm::pdb::NamedStreamMap::get
bool get(StringRef Stream, uint32_t &StreamNo) const
Definition: NamedStreamMap.cpp:100
llvm::pdb::NamedStreamMap
Definition: NamedStreamMap.h:37
llvm::pdb::NamedStreamMapTraits::NS
NamedStreamMap * NS
Definition: NamedStreamMap.h:29
iterator_range.h
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:157
llvm::pdb::NamedStreamMapTraits::hashLookupKey
uint16_t hashLookupKey(StringRef S) const
Definition: NamedStreamMap.cpp:31
llvm::pdb::HashTable
Definition: HashTable.h:34
llvm::pdb::NamedStreamMapTraits
Definition: NamedStreamMap.h:28