LCOV - code coverage report
Current view: top level - lib/DebugInfo/PDB - PDBSymbolData.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 0 30 0.0 %
Date: 2018-10-20 13:21:21 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- PDBSymbolData.cpp - PDB data (e.g. variable) accessors ---*- 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/PDB/PDBSymbolData.h"
      11             : #include "llvm/DebugInfo/PDB/IPDBSectionContrib.h"
      12             : #include "llvm/DebugInfo/PDB/IPDBSession.h"
      13             : #include "llvm/DebugInfo/PDB/PDBSymDumper.h"
      14             : 
      15             : #include <utility>
      16             : 
      17             : using namespace llvm;
      18             : using namespace llvm::pdb;
      19             : 
      20           0 : void PDBSymbolData::dump(PDBSymDumper &Dumper) const { Dumper.dump(*this); }
      21             : 
      22           0 : std::unique_ptr<IPDBEnumLineNumbers> PDBSymbolData::getLineNumbers() const {
      23           0 :   auto Len = RawSymbol->getLength();
      24           0 :   Len = Len ? Len : 1;
      25           0 :   if (auto RVA = RawSymbol->getRelativeVirtualAddress())
      26           0 :     return Session.findLineNumbersByRVA(RVA, Len);
      27             : 
      28           0 :   if (auto Section = RawSymbol->getAddressSection())
      29           0 :     return Session.findLineNumbersBySectOffset(
      30           0 :         Section, RawSymbol->getAddressOffset(), Len);
      31             : 
      32             :   return nullptr;
      33             : }
      34             : 
      35           0 : uint32_t PDBSymbolData::getCompilandId() const {
      36           0 :   if (auto Lines = getLineNumbers()) {
      37           0 :     if (auto FirstLine = Lines->getNext())
      38           0 :       return FirstLine->getCompilandId();
      39             :   }
      40             : 
      41           0 :   uint32_t DataSection = RawSymbol->getAddressSection();
      42           0 :   uint32_t DataOffset = RawSymbol->getAddressOffset();
      43           0 :   if (DataSection == 0) {
      44           0 :     if (auto RVA = RawSymbol->getRelativeVirtualAddress())
      45           0 :       Session.addressForRVA(RVA, DataSection, DataOffset);
      46             :   }
      47             : 
      48           0 :   if (DataSection) {
      49           0 :     if (auto SecContribs = Session.getSectionContribs()) {
      50           0 :       while (auto Section = SecContribs->getNext()) {
      51           0 :         if (Section->getAddressSection() == DataSection &&
      52           0 :             Section->getAddressOffset() <= DataOffset &&
      53           0 :             (Section->getAddressOffset() + Section->getLength()) > DataOffset)
      54           0 :           return Section->getCompilandId();
      55             :       }
      56             :     }
      57             :   } else {
      58           0 :     auto LexParentId = RawSymbol->getLexicalParentId();
      59           0 :     while (auto LexParent = Session.getSymbolById(LexParentId)) {
      60           0 :       if (LexParent->getSymTag() == PDB_SymType::Exe)
      61             :         break;
      62           0 :       if (LexParent->getSymTag() == PDB_SymType::Compiland)
      63             :         return LexParentId;
      64           0 :       LexParentId = LexParent->getRawSymbol().getLexicalParentId();
      65             :     }
      66             :   }
      67             : 
      68             :   return 0;
      69             : }

Generated by: LCOV version 1.13