]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302069, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / PDB / Native / PDBStringTableBuilder.h
1 //===- PDBStringTableBuilder.h - PDB String Table Builder -------*- 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 // This file creates the "/names" stream.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H
15 #define LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H
16
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/DebugInfo/CodeView/StringTable.h"
20 #include "llvm/Support/Error.h"
21 #include <vector>
22
23 namespace llvm {
24 class BinaryStreamWriter;
25 class WritableBinaryStreamRef;
26
27 namespace msf {
28 struct MSFLayout;
29 }
30
31 namespace pdb {
32
33 class PDBFileBuilder;
34
35 class PDBStringTableBuilder {
36 public:
37   // If string S does not exist in the string table, insert it.
38   // Returns the ID for S.
39   uint32_t insert(StringRef S);
40
41   uint32_t calculateSerializedSize() const;
42   Error commit(BinaryStreamWriter &Writer) const;
43
44   codeview::StringTable &getStrings() { return Strings; }
45   const codeview::StringTable &getStrings() const { return Strings; }
46
47 private:
48   uint32_t calculateHashTableSize() const;
49   Error writeHeader(BinaryStreamWriter &Writer) const;
50   Error writeStrings(BinaryStreamWriter &Writer) const;
51   Error writeHashTable(BinaryStreamWriter &Writer) const;
52   Error writeEpilogue(BinaryStreamWriter &Writer) const;
53
54   codeview::StringTable Strings;
55 };
56
57 } // end namespace pdb
58 } // end namespace llvm
59
60 #endif // LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H