From 31eb748944903b7f4f38afda9851951ca9dfc1ae Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 4 Oct 2017 20:27:34 +0000 Subject: Import LLVM 5.0.0 release including clang, lld and lldb. --- .../CodeView/DebugFrameDataSubsection.cpp | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 gnu/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp (limited to 'gnu/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp') diff --git a/gnu/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp b/gnu/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp new file mode 100644 index 00000000000..fd558aa9cc8 --- /dev/null +++ b/gnu/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp @@ -0,0 +1,44 @@ +//===- DebugFrameDataSubsection.cpp -----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h" +#include "llvm/DebugInfo/CodeView/CodeViewError.h" + +using namespace llvm; +using namespace llvm::codeview; + +Error DebugFrameDataSubsectionRef::initialize(BinaryStreamReader Reader) { + if (auto EC = Reader.readObject(RelocPtr)) + return EC; + if (Reader.bytesRemaining() % sizeof(FrameData) != 0) + return make_error(cv_error_code::corrupt_record, + "Invalid frame data record format!"); + + uint32_t Count = Reader.bytesRemaining() / sizeof(FrameData); + if (auto EC = Reader.readArray(Frames, Count)) + return EC; + return Error::success(); +} + +uint32_t DebugFrameDataSubsection::calculateSerializedSize() const { + return 4 + sizeof(FrameData) * Frames.size(); +} + +Error DebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const { + if (auto EC = Writer.writeInteger(0)) + return EC; + + if (auto EC = Writer.writeArray(makeArrayRef(Frames))) + return EC; + return Error::success(); +} + +void DebugFrameDataSubsection::addFrameData(const FrameData &Frame) { + Frames.push_back(Frame); +} -- cgit v1.2.3-59-g8ed1b