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