LLVM  6.0.0svn
DebugCrossExSubsection.cpp
Go to the documentation of this file.
1 //===- DebugCrossExSubsection.cpp -----------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
13 #include "llvm/Support/Error.h"
14 #include <cstdint>
15 
16 using namespace llvm;
17 using namespace llvm::codeview;
18 
20  BinaryStreamReader Reader) {
21  if (Reader.bytesRemaining() % sizeof(CrossModuleExport) != 0)
22  return make_error<CodeViewError>(
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 
31  BinaryStreamReader Reader(Stream);
32  return initialize(Reader);
33 }
34 
36  uint32_t Global) {
37  Mappings[Local] = Global;
38 }
39 
41  return Mappings.size() * sizeof(CrossModuleExport);
42 }
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 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Provides write only access to a subclass of WritableBinaryStream.
Error commit(BinaryStreamWriter &Writer) const override
Error writeInteger(T Value)
Write the the integer Value to the underlying stream in the specified endianness. ...
static ErrorSuccess success()
Create a success value.
Definition: Error.h:313
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
uint32_t bytesRemaining() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
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 ...
void addMapping(uint32_t Local, uint32_t Global)