LLVM 22.0.0git
DebugCrossExSubsection.cpp
Go to the documentation of this file.
1//===- DebugCrossExSubsection.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
13#include "llvm/Support/Error.h"
14#include <cstdint>
15
16using namespace llvm;
17using namespace llvm::codeview;
18
20 BinaryStreamReader Reader) {
21 if (Reader.bytesRemaining() % sizeof(CrossModuleExport) != 0)
24 "Cross Scope Exports section is an invalid size!");
25
26 uint32_t Size = Reader.bytesRemaining() / sizeof(CrossModuleExport);
27 return Reader.readArray(References, Size);
28}
29
34
39
43
45 BinaryStreamWriter &Writer) const {
46 for (const auto &M : Mappings) {
47 if (auto EC = Writer.writeInteger(M.first))
48 return EC;
49 if (auto EC = Writer.writeInteger(M.second))
50 return EC;
51 }
52 return Error::success();
53}
Provides read only access to a subclass of BinaryStream.
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Provides write only access to a subclass of WritableBinaryStream.
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
LLVM_ABI Error initialize(BinaryStreamReader Reader)
Error commit(BinaryStreamWriter &Writer) const override
This is an optimization pass for GlobalISel generic memory operations.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340
@ Global
Append to llvm.global_dtors.