LCOV - code coverage report
Current view: top level - lib/DebugInfo/PDB - PDBSymbolTypeFunctionSig.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 4 30 13.3 %
Date: 2017-09-14 15:23:50 Functions: 1 11 9.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- PDBSymbolTypeFunctionSig.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/PDB/PDBSymbolTypeFunctionSig.h"
      11             : 
      12             : #include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
      13             : #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
      14             : #include "llvm/DebugInfo/PDB/IPDBSession.h"
      15             : #include "llvm/DebugInfo/PDB/PDBSymDumper.h"
      16             : #include "llvm/DebugInfo/PDB/PDBSymbol.h"
      17             : #include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
      18             : 
      19             : #include <utility>
      20             : 
      21             : using namespace llvm;
      22             : using namespace llvm::pdb;
      23             : 
      24             : namespace {
      25           0 : class FunctionArgEnumerator : public IPDBEnumSymbols {
      26             : public:
      27             :   typedef ConcreteSymbolEnumerator<PDBSymbolTypeFunctionArg> ArgEnumeratorType;
      28             : 
      29             :   FunctionArgEnumerator(const IPDBSession &PDBSession,
      30             :                         const PDBSymbolTypeFunctionSig &Sig)
      31           0 :       : Session(PDBSession),
      32           0 :         Enumerator(Sig.findAllChildren<PDBSymbolTypeFunctionArg>()) {}
      33             : 
      34             :   FunctionArgEnumerator(const IPDBSession &PDBSession,
      35             :                         std::unique_ptr<ArgEnumeratorType> ArgEnumerator)
      36           0 :       : Session(PDBSession), Enumerator(std::move(ArgEnumerator)) {}
      37             : 
      38           0 :   uint32_t getChildCount() const override {
      39           0 :     return Enumerator->getChildCount();
      40             :   }
      41             : 
      42           0 :   std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t Index) const override {
      43           0 :     auto FunctionArgSymbol = Enumerator->getChildAtIndex(Index);
      44           0 :     if (!FunctionArgSymbol)
      45             :       return nullptr;
      46           0 :     return Session.getSymbolById(FunctionArgSymbol->getTypeId());
      47             :   }
      48             : 
      49           0 :   std::unique_ptr<PDBSymbol> getNext() override {
      50           0 :     auto FunctionArgSymbol = Enumerator->getNext();
      51           0 :     if (!FunctionArgSymbol)
      52             :       return nullptr;
      53           0 :     return Session.getSymbolById(FunctionArgSymbol->getTypeId());
      54             :   }
      55             : 
      56           0 :   void reset() override { Enumerator->reset(); }
      57             : 
      58           0 :   MyType *clone() const override {
      59           0 :     std::unique_ptr<ArgEnumeratorType> Clone(Enumerator->clone());
      60           0 :     return new FunctionArgEnumerator(Session, std::move(Clone));
      61             :   }
      62             : 
      63             : private:
      64             :   const IPDBSession &Session;
      65             :   std::unique_ptr<ArgEnumeratorType> Enumerator;
      66             : };
      67             : }
      68             : 
      69           1 : PDBSymbolTypeFunctionSig::PDBSymbolTypeFunctionSig(
      70           1 :     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
      71           3 :     : PDBSymbol(PDBSession, std::move(Symbol)) {
      72             :   assert(RawSymbol->getSymTag() == PDB_SymType::FunctionSig);
      73           1 : }
      74             : 
      75             : std::unique_ptr<IPDBEnumSymbols>
      76           0 : PDBSymbolTypeFunctionSig::getArguments() const {
      77           0 :   return llvm::make_unique<FunctionArgEnumerator>(Session, *this);
      78             : }
      79             : 
      80           0 : void PDBSymbolTypeFunctionSig::dump(PDBSymDumper &Dumper) const {
      81           0 :   Dumper.dump(*this);
      82           0 : }
      83             : 
      84           0 : void PDBSymbolTypeFunctionSig::dumpRight(PDBSymDumper &Dumper) const {
      85           0 :   Dumper.dumpRight(*this);
      86           0 : }

Generated by: LCOV version 1.13