]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/PDB/Native/PDBStringTable.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304659, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / PDB / Native / PDBStringTable.h
1 //===- PDBStringTable.h - PDB String Table -----------------------*- 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_PDBSTRINGTABLE_H
11 #define LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLE_H
12
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
16 #include "llvm/Support/BinaryStreamArray.h"
17 #include "llvm/Support/BinaryStreamRef.h"
18 #include "llvm/Support/Endian.h"
19 #include "llvm/Support/Error.h"
20 #include <cstdint>
21 #include <vector>
22
23 namespace llvm {
24 class BinaryStreamReader;
25
26 namespace msf {
27 class MappedBlockStream;
28 }
29
30 namespace pdb {
31
32 struct PDBStringTableHeader;
33
34 class PDBStringTable {
35 public:
36   Error reload(BinaryStreamReader &Reader);
37
38   uint32_t getByteSize() const;
39   uint32_t getNameCount() const;
40   uint32_t getHashVersion() const;
41   uint32_t getSignature() const;
42
43   Expected<StringRef> getStringForID(uint32_t ID) const;
44   Expected<uint32_t> getIDForString(StringRef Str) const;
45
46   FixedStreamArray<support::ulittle32_t> name_ids() const;
47
48   codeview::DebugStringTableSubsectionRef getStringTable() const;
49
50 private:
51   Error readHeader(BinaryStreamReader &Reader);
52   Error readStrings(BinaryStreamReader &Reader);
53   Error readHashTable(BinaryStreamReader &Reader);
54   Error readEpilogue(BinaryStreamReader &Reader);
55
56   const PDBStringTableHeader *Header = nullptr;
57   codeview::DebugStringTableSubsectionRef Strings;
58   FixedStreamArray<support::ulittle32_t> IDs;
59   uint32_t ByteSize = 0;
60   uint32_t NameCount = 0;
61 };
62
63 } // end namespace pdb
64 } // end namespace llvm
65
66 #endif // LLVM_DEBUGINFO_PDB_RAW_STRINGTABLE_H