LCOV - code coverage report
Current view: top level - lib/DebugInfo/CodeView - DebugFrameDataSubsection.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 15 20 75.0 %
Date: 2017-09-14 15:23:50 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"
      11             : #include "llvm/DebugInfo/CodeView/CodeViewError.h"
      12             : 
      13             : using namespace llvm;
      14             : using namespace llvm::codeview;
      15             : 
      16          21 : Error DebugFrameDataSubsectionRef::initialize(BinaryStreamReader Reader) {
      17          63 :   if (auto EC = Reader.readObject(RelocPtr))
      18           0 :     return EC;
      19          21 :   if (Reader.bytesRemaining() % sizeof(FrameData) != 0)
      20             :     return make_error<CodeViewError>(cv_error_code::corrupt_record,
      21           0 :                                      "Invalid frame data record format!");
      22             : 
      23          21 :   uint32_t Count = Reader.bytesRemaining() / sizeof(FrameData);
      24          63 :   if (auto EC = Reader.readArray(Frames, Count))
      25           0 :     return EC;
      26          63 :   return Error::success();
      27             : }
      28             : 
      29           3 : uint32_t DebugFrameDataSubsection::calculateSerializedSize() const {
      30           6 :   return 4 + sizeof(FrameData) * Frames.size();
      31             : }
      32             : 
      33           1 : Error DebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const {
      34           3 :   if (auto EC = Writer.writeInteger<uint32_t>(0))
      35           0 :     return EC;
      36             : 
      37           4 :   if (auto EC = Writer.writeArray(makeArrayRef(Frames)))
      38           0 :     return EC;
      39           3 :   return Error::success();
      40             : }
      41             : 
      42           1 : void DebugFrameDataSubsection::addFrameData(const FrameData &Frame) {
      43           1 :   Frames.push_back(Frame);
      44           1 : }

Generated by: LCOV version 1.13