LLVM  6.0.0svn
DebugFrameDataSubsection.cpp
Go to the documentation of this file.
1 //===- DebugFrameDataSubsection.cpp -----------------------------*- C++ -*-===//
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 
12 
13 using namespace llvm;
14 using namespace llvm::codeview;
15 
17  if (auto EC = Reader.readObject(RelocPtr))
18  return EC;
19  if (Reader.bytesRemaining() % sizeof(FrameData) != 0)
20  return make_error<CodeViewError>(cv_error_code::corrupt_record,
21  "Invalid frame data record format!");
22 
23  uint32_t Count = Reader.bytesRemaining() / sizeof(FrameData);
24  if (auto EC = Reader.readArray(Frames, Count))
25  return EC;
26  return Error::success();
27 }
28 
30  return 4 + sizeof(FrameData) * Frames.size();
31 }
32 
34  if (auto EC = Writer.writeInteger<uint32_t>(0))
35  return EC;
36 
37  if (auto EC = Writer.writeArray(makeArrayRef(Frames)))
38  return EC;
39  return Error::success();
40 }
41 
43  Frames.push_back(Frame);
44 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Data in the the SUBSEC_FRAMEDATA subection.
Definition: CodeView.h:535
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
Error commit(BinaryStreamWriter &Writer) const override
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:451
Error writeArray(ArrayRef< T > Array)
Writes an array of objects of type T to the underlying stream, as if by using memcpy.
Provides write only access to a subclass of WritableBinaryStream.
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
uint32_t bytesRemaining() const
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 ...