DebugSymbolRVASubsection.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //===- DebugSymbolRVASubsection.h -------------------------------*- 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. #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
  9. #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
  10. #include "llvm/DebugInfo/CodeView/CodeView.h"
  11. #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
  12. #include "llvm/Support/BinaryStreamArray.h"
  13. #include "llvm/Support/Endian.h"
  14. #include "llvm/Support/Error.h"
  15. #include <cstdint>
  16. #include <vector>
  17. namespace llvm {
  18. class BinaryStreamReader;
  19. namespace codeview {
  20. class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
  21. public:
  22. using ArrayType = FixedStreamArray<support::ulittle32_t>;
  23. DebugSymbolRVASubsectionRef();
  24. static bool classof(const DebugSubsectionRef *S) {
  25. return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
  26. }
  27. ArrayType::Iterator begin() const { return RVAs.begin(); }
  28. ArrayType::Iterator end() const { return RVAs.end(); }
  29. Error initialize(BinaryStreamReader &Reader);
  30. private:
  31. ArrayType RVAs;
  32. };
  33. class DebugSymbolRVASubsection final : public DebugSubsection {
  34. public:
  35. DebugSymbolRVASubsection();
  36. static bool classof(const DebugSubsection *S) {
  37. return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
  38. }
  39. Error commit(BinaryStreamWriter &Writer) const override;
  40. uint32_t calculateSerializedSize() const override;
  41. void addRVA(uint32_t RVA) { RVAs.push_back(support::ulittle32_t(RVA)); }
  42. private:
  43. std::vector<support::ulittle32_t> RVAs;
  44. };
  45. } // end namespace codeview
  46. } // end namespace llvm
  47. #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H