Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:45

0001 //===- PDBStringTableBuilder.h - PDB String Table Builder -------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file creates the "/names" stream.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLEBUILDER_H
0014 #define LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLEBUILDER_H
0015 
0016 #include "llvm/ADT/StringRef.h"
0017 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
0018 #include "llvm/Support/Error.h"
0019 #include <cstdint>
0020 
0021 namespace llvm {
0022 class BinaryStreamWriter;
0023 class WritableBinaryStreamRef;
0024 
0025 namespace msf {
0026 struct MSFLayout;
0027 }
0028 
0029 namespace pdb {
0030 
0031 class PDBFileBuilder;
0032 class PDBStringTableBuilder;
0033 
0034 struct StringTableHashTraits {
0035   PDBStringTableBuilder *Table;
0036 
0037   explicit StringTableHashTraits(PDBStringTableBuilder &Table);
0038   uint32_t hashLookupKey(StringRef S) const;
0039   StringRef storageKeyToLookupKey(uint32_t Offset) const;
0040   uint32_t lookupKeyToStorageKey(StringRef S);
0041 };
0042 
0043 class PDBStringTableBuilder {
0044 public:
0045   // If string S does not exist in the string table, insert it.
0046   // Returns the ID for S.
0047   uint32_t insert(StringRef S);
0048 
0049   uint32_t getIdForString(StringRef S) const;
0050   StringRef getStringForId(uint32_t Id) const;
0051 
0052   uint32_t calculateSerializedSize() const;
0053   Error commit(BinaryStreamWriter &Writer) const;
0054 
0055   void setStrings(const codeview::DebugStringTableSubsection &Strings);
0056 
0057 private:
0058   uint32_t calculateHashTableSize() const;
0059   Error writeHeader(BinaryStreamWriter &Writer) const;
0060   Error writeStrings(BinaryStreamWriter &Writer) const;
0061   Error writeHashTable(BinaryStreamWriter &Writer) const;
0062   Error writeEpilogue(BinaryStreamWriter &Writer) const;
0063 
0064   codeview::DebugStringTableSubsection Strings;
0065 };
0066 
0067 } // end namespace pdb
0068 } // end namespace llvm
0069 
0070 #endif // LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLEBUILDER_H