[InstCombine] Signed saturation patterns
[llvm-complete.git] / include / llvm / DebugInfo / PDB / Native / PDBStringTableBuilder.h
blob57267ef5c6c599c1fa7d0d3c9afbdf0a5f5de37e
1 //===- PDBStringTableBuilder.h - PDB String Table Builder -------*- 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 // This file creates the "/names" stream.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H
14 #define LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
19 #include "llvm/Support/Error.h"
20 #include <vector>
22 namespace llvm {
23 class BinaryStreamWriter;
24 class WritableBinaryStreamRef;
26 namespace msf {
27 struct MSFLayout;
30 namespace pdb {
32 class PDBFileBuilder;
33 class PDBStringTableBuilder;
35 struct StringTableHashTraits {
36 PDBStringTableBuilder *Table;
38 explicit StringTableHashTraits(PDBStringTableBuilder &Table);
39 uint32_t hashLookupKey(StringRef S) const;
40 StringRef storageKeyToLookupKey(uint32_t Offset) const;
41 uint32_t lookupKeyToStorageKey(StringRef S);
44 class PDBStringTableBuilder {
45 public:
46 // If string S does not exist in the string table, insert it.
47 // Returns the ID for S.
48 uint32_t insert(StringRef S);
50 uint32_t getIdForString(StringRef S) const;
51 StringRef getStringForId(uint32_t Id) const;
53 uint32_t calculateSerializedSize() const;
54 Error commit(BinaryStreamWriter &Writer) const;
56 void setStrings(const codeview::DebugStringTableSubsection &Strings);
58 private:
59 uint32_t calculateHashTableSize() const;
60 Error writeHeader(BinaryStreamWriter &Writer) const;
61 Error writeStrings(BinaryStreamWriter &Writer) const;
62 Error writeHashTable(BinaryStreamWriter &Writer) const;
63 Error writeEpilogue(BinaryStreamWriter &Writer) const;
65 codeview::DebugStringTableSubsection Strings;
68 } // end namespace pdb
69 } // end namespace llvm
71 #endif // LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H