DebugSymbolRVASubsection.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //===- DebugSymbolRVASubsection.cpp ---------------------------------------===//
  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. #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
  9. #include "llvm/ADT/ArrayRef.h"
  10. #include "llvm/DebugInfo/CodeView/CodeView.h"
  11. #include "llvm/Support/BinaryStreamReader.h"
  12. #include "llvm/Support/BinaryStreamWriter.h"
  13. #include <cstdint>
  14. using namespace llvm;
  15. using namespace llvm::codeview;
  16. DebugSymbolRVASubsectionRef::DebugSymbolRVASubsectionRef()
  17. : DebugSubsectionRef(DebugSubsectionKind::CoffSymbolRVA) {}
  18. Error DebugSymbolRVASubsectionRef::initialize(BinaryStreamReader &Reader) {
  19. return Reader.readArray(RVAs, Reader.bytesRemaining() / sizeof(uint32_t));
  20. }
  21. DebugSymbolRVASubsection::DebugSymbolRVASubsection()
  22. : DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {}
  23. Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const {
  24. return Writer.writeArray(makeArrayRef(RVAs));
  25. }
  26. uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const {
  27. return RVAs.size() * sizeof(uint32_t);
  28. }