DebugSymbolRVASubsection.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DebugSymbolRVASubsection.h -------------------------------*- 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_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
  14. #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
  15. #include "llvm/DebugInfo/CodeView/CodeView.h"
  16. #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
  17. #include "llvm/Support/BinaryStreamArray.h"
  18. #include "llvm/Support/Endian.h"
  19. #include "llvm/Support/Error.h"
  20. #include <cstdint>
  21. #include <vector>
  22. namespace llvm {
  23. class BinaryStreamReader;
  24. namespace codeview {
  25. class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
  26. public:
  27. using ArrayType = FixedStreamArray<support::ulittle32_t>;
  28. DebugSymbolRVASubsectionRef();
  29. static bool classof(const DebugSubsectionRef *S) {
  30. return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
  31. }
  32. ArrayType::Iterator begin() const { return RVAs.begin(); }
  33. ArrayType::Iterator end() const { return RVAs.end(); }
  34. Error initialize(BinaryStreamReader &Reader);
  35. private:
  36. ArrayType RVAs;
  37. };
  38. class DebugSymbolRVASubsection final : public DebugSubsection {
  39. public:
  40. DebugSymbolRVASubsection();
  41. static bool classof(const DebugSubsection *S) {
  42. return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
  43. }
  44. Error commit(BinaryStreamWriter &Writer) const override;
  45. uint32_t calculateSerializedSize() const override;
  46. void addRVA(uint32_t RVA) { RVAs.push_back(support::ulittle32_t(RVA)); }
  47. private:
  48. std::vector<support::ulittle32_t> RVAs;
  49. };
  50. } // end namespace codeview
  51. } // end namespace llvm
  52. #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
  53. #ifdef __GNUC__
  54. #pragma GCC diagnostic pop
  55. #endif