PDBStringTable.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- PDBStringTable.h - PDB String Table -----------------------*- C++-*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLE_H
  14. #define LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLE_H
  15. #include "llvm/ADT/StringRef.h"
  16. #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
  17. #include "llvm/Support/BinaryStreamArray.h"
  18. #include "llvm/Support/Endian.h"
  19. #include "llvm/Support/Error.h"
  20. #include <cstdint>
  21. namespace llvm {
  22. class BinaryStreamReader;
  23. namespace pdb {
  24. struct PDBStringTableHeader;
  25. class PDBStringTable {
  26. public:
  27. Error reload(BinaryStreamReader &Reader);
  28. uint32_t getByteSize() const;
  29. uint32_t getNameCount() const;
  30. uint32_t getHashVersion() const;
  31. uint32_t getSignature() const;
  32. Expected<StringRef> getStringForID(uint32_t ID) const;
  33. Expected<uint32_t> getIDForString(StringRef Str) const;
  34. FixedStreamArray<support::ulittle32_t> name_ids() const;
  35. const codeview::DebugStringTableSubsectionRef &getStringTable() const;
  36. private:
  37. Error readHeader(BinaryStreamReader &Reader);
  38. Error readStrings(BinaryStreamReader &Reader);
  39. Error readHashTable(BinaryStreamReader &Reader);
  40. Error readEpilogue(BinaryStreamReader &Reader);
  41. const PDBStringTableHeader *Header = nullptr;
  42. codeview::DebugStringTableSubsectionRef Strings;
  43. FixedStreamArray<support::ulittle32_t> IDs;
  44. uint32_t NameCount = 0;
  45. };
  46. } // end namespace pdb
  47. } // end namespace llvm
  48. #endif // LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLE_H
  49. #ifdef __GNUC__
  50. #pragma GCC diagnostic pop
  51. #endif