LCOV - code coverage report
Current view: top level - lib/DebugInfo/PDB/Native - DbiModuleDescriptor.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 30 36 83.3 %
Date: 2017-09-14 15:23:50 Functions: 12 13 92.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- DbiModuleDescriptor.cpp - PDB module information -------------------===//
       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/PDB/Native/DbiModuleDescriptor.h"
      11             : #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
      12             : #include "llvm/Support/BinaryStreamReader.h"
      13             : #include "llvm/Support/Endian.h"
      14             : #include "llvm/Support/Error.h"
      15             : #include "llvm/Support/MathExtras.h"
      16             : #include <cstdint>
      17             : 
      18             : using namespace llvm;
      19             : using namespace llvm::pdb;
      20             : using namespace llvm::support;
      21             : 
      22             : DbiModuleDescriptor::DbiModuleDescriptor() = default;
      23             : 
      24             : DbiModuleDescriptor::DbiModuleDescriptor(const DbiModuleDescriptor &Info) =
      25             :     default;
      26             : 
      27             : DbiModuleDescriptor::~DbiModuleDescriptor() = default;
      28             : 
      29         868 : Error DbiModuleDescriptor::initialize(BinaryStreamRef Stream,
      30             :                                       DbiModuleDescriptor &Info) {
      31        2604 :   BinaryStreamReader Reader(Stream);
      32        2604 :   if (auto EC = Reader.readObject(Info.Layout))
      33           0 :     return EC;
      34             : 
      35        2604 :   if (auto EC = Reader.readCString(Info.ModuleName))
      36           0 :     return EC;
      37             : 
      38        2604 :   if (auto EC = Reader.readCString(Info.ObjFileName))
      39           0 :     return EC;
      40        2604 :   return Error::success();
      41             : }
      42             : 
      43         110 : bool DbiModuleDescriptor::hasECInfo() const {
      44         220 :   return (Layout->Flags & ModInfoFlags::HasECFlagMask) != 0;
      45             : }
      46             : 
      47           0 : uint16_t DbiModuleDescriptor::getTypeServerIndex() const {
      48           0 :   return (Layout->Flags & ModInfoFlags::TypeServerIndexMask) >>
      49           0 :          ModInfoFlags::TypeServerIndexShift;
      50             : }
      51             : 
      52         451 : uint16_t DbiModuleDescriptor::getModuleStreamIndex() const {
      53         902 :   return Layout->ModDiStream;
      54             : }
      55             : 
      56         312 : uint32_t DbiModuleDescriptor::getSymbolDebugInfoByteSize() const {
      57         624 :   return Layout->SymBytes;
      58             : }
      59             : 
      60         312 : uint32_t DbiModuleDescriptor::getC11LineInfoByteSize() const {
      61         624 :   return Layout->C11Bytes;
      62             : }
      63             : 
      64         312 : uint32_t DbiModuleDescriptor::getC13LineInfoByteSize() const {
      65         624 :   return Layout->C13Bytes;
      66             : }
      67             : 
      68         114 : uint32_t DbiModuleDescriptor::getNumberOfFiles() const {
      69         228 :   return Layout->NumFiles;
      70             : }
      71             : 
      72         224 : uint32_t DbiModuleDescriptor::getSourceFileNameIndex() const {
      73         448 :   return Layout->SrcFileNameNI;
      74             : }
      75             : 
      76         224 : uint32_t DbiModuleDescriptor::getPdbFilePathNameIndex() const {
      77         448 :   return Layout->PdbFilePathNI;
      78             : }
      79             : 
      80         359 : StringRef DbiModuleDescriptor::getModuleName() const { return ModuleName; }
      81             : 
      82         135 : StringRef DbiModuleDescriptor::getObjFileName() const { return ObjFileName; }
      83             : 
      84         868 : uint32_t DbiModuleDescriptor::getRecordLength() const {
      85        2604 :   uint32_t M = ModuleName.str().size() + 1;
      86        2604 :   uint32_t O = ObjFileName.str().size() + 1;
      87         868 :   uint32_t Size = sizeof(ModuleInfoHeader) + M + O;
      88        1736 :   Size = alignTo(Size, 4);
      89         868 :   return Size;
      90             : }

Generated by: LCOV version 1.13