Eugene Zelenko | 8456b16 | 2017-06-29 00:05:44 +0000 | [diff] [blame] | 1 | //===- DebugSymbolRVASubsection.cpp ---------------------------------------===// |
Zachary Turner | 3226fe9 | 2017-06-09 20:46:52 +0000 | [diff] [blame] | 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame^] | 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 |
Zachary Turner | 3226fe9 | 2017-06-09 20:46:52 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h" |
Eugene Zelenko | 8456b16 | 2017-06-29 00:05:44 +0000 | [diff] [blame] | 10 | #include "llvm/ADT/ArrayRef.h" |
| 11 | #include "llvm/DebugInfo/CodeView/CodeView.h" |
| 12 | #include "llvm/Support/BinaryStreamReader.h" |
| 13 | #include "llvm/Support/BinaryStreamWriter.h" |
| 14 | #include <cstdint> |
Zachary Turner | 3226fe9 | 2017-06-09 20:46:52 +0000 | [diff] [blame] | 15 | |
| 16 | using namespace llvm; |
| 17 | using namespace llvm::codeview; |
| 18 | |
| 19 | DebugSymbolRVASubsectionRef::DebugSymbolRVASubsectionRef() |
| 20 | : DebugSubsectionRef(DebugSubsectionKind::CoffSymbolRVA) {} |
| 21 | |
| 22 | Error DebugSymbolRVASubsectionRef::initialize(BinaryStreamReader &Reader) { |
| 23 | return Reader.readArray(RVAs, Reader.bytesRemaining() / sizeof(uint32_t)); |
| 24 | } |
| 25 | |
| 26 | DebugSymbolRVASubsection::DebugSymbolRVASubsection() |
| 27 | : DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {} |
| 28 | |
| 29 | Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const { |
| 30 | return Writer.writeArray(makeArrayRef(RVAs)); |
| 31 | } |
| 32 | |
| 33 | uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const { |
| 34 | return RVAs.size() * sizeof(uint32_t); |
| 35 | } |