LCOV - code coverage report
Current view: top level - lib/DebugInfo/CodeView - ModuleSubstream.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 12 16 75.0 %
Date: 2017-04-27 17:53:54 Functions: 5 6 83.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- ModuleSubstream.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/ModuleSubstream.h"
      11             : 
      12             : #include "llvm/Support/BinaryStreamReader.h"
      13             : 
      14             : using namespace llvm;
      15             : using namespace llvm::codeview;
      16             : 
      17          20 : ModuleSubstream::ModuleSubstream() : Kind(ModuleSubstreamKind::None) {}
      18             : 
      19           0 : ModuleSubstream::ModuleSubstream(ModuleSubstreamKind Kind, BinaryStreamRef Data)
      20           0 :     : Kind(Kind), Data(Data) {}
      21             : 
      22           6 : Error ModuleSubstream::initialize(BinaryStreamRef Stream,
      23             :                                   ModuleSubstream &Info) {
      24             :   const ModuleSubsectionHeader *Header;
      25          12 :   BinaryStreamReader Reader(Stream);
      26          18 :   if (auto EC = Reader.readObject(Header))
      27           0 :     return EC;
      28             : 
      29             :   ModuleSubstreamKind Kind =
      30          12 :       static_cast<ModuleSubstreamKind>(uint32_t(Header->Kind));
      31          24 :   if (auto EC = Reader.readStreamRef(Info.Data, Header->Length))
      32           0 :     return EC;
      33           6 :   Info.Kind = Kind;
      34          18 :   return Error::success();
      35             : }
      36             : 
      37           6 : uint32_t ModuleSubstream::getRecordLength() const {
      38           6 :   return sizeof(ModuleSubsectionHeader) + Data.getLength();
      39             : }
      40             : 
      41           6 : ModuleSubstreamKind ModuleSubstream::getSubstreamKind() const { return Kind; }
      42             : 
      43          12 : BinaryStreamRef ModuleSubstream::getRecordData() const { return Data; }

Generated by: LCOV version 1.13