1 //===- PDBStringTable.h - PDB String Table -----------------------*- 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_PDBSTRINGTABLE_H 10 #define LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLE_H 11 12 #include "llvm/ADT/StringRef.h" 13 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h" 14 #include "llvm/Support/BinaryStreamArray.h" 15 #include "llvm/Support/Endian.h" 16 #include "llvm/Support/Error.h" 17 #include <cstdint> 18 19 namespace llvm { 20 class BinaryStreamReader; 21 22 namespace pdb { 23 24 struct PDBStringTableHeader; 25 26 class PDBStringTable { 27 public: 28 Error reload(BinaryStreamReader &Reader); 29 30 uint32_t getByteSize() const; 31 uint32_t getNameCount() const; 32 uint32_t getHashVersion() const; 33 uint32_t getSignature() const; 34 35 Expected<StringRef> getStringForID(uint32_t ID) const; 36 Expected<uint32_t> getIDForString(StringRef Str) const; 37 38 FixedStreamArray<support::ulittle32_t> name_ids() const; 39 40 const codeview::DebugStringTableSubsectionRef &getStringTable() const; 41 42 private: 43 Error readHeader(BinaryStreamReader &Reader); 44 Error readStrings(BinaryStreamReader &Reader); 45 Error readHashTable(BinaryStreamReader &Reader); 46 Error readEpilogue(BinaryStreamReader &Reader); 47 48 const PDBStringTableHeader *Header = nullptr; 49 codeview::DebugStringTableSubsectionRef Strings; 50 FixedStreamArray<support::ulittle32_t> IDs; 51 uint32_t NameCount = 0; 52 }; 53 54 } // end namespace pdb 55 } // end namespace llvm 56 57 #endif // LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLE_H 58