LCOV - code coverage report
Current view: top level - lib/DebugInfo/PDB/Native - NativeEnumTypes.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 15 21 71.4 %
Date: 2017-09-14 15:23:50 Functions: 4 7 57.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //==- NativeEnumTypes.cpp - Native Type Enumerator impl ----------*- 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/Native/NativeEnumTypes.h"
      11             : 
      12             : #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
      13             : #include "llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h"
      14             : #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
      15             : #include "llvm/DebugInfo/PDB/PDBSymbol.h"
      16             : #include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
      17             : 
      18             : namespace llvm {
      19             : namespace pdb {
      20             : 
      21           1 : NativeEnumTypes::NativeEnumTypes(NativeSession &PDBSession,
      22             :                                  codeview::LazyRandomTypeCollection &Types,
      23           1 :                                  codeview::TypeLeafKind Kind)
      24           2 :     : Matches(), Index(0), Session(PDBSession), Kind(Kind) {
      25         308 :   for (auto Index = Types.getFirst(); Index;
      26         459 :        Index = Types.getNext(Index.getValue())) {
      27         459 :     if (Types.getType(Index.getValue()).kind() == Kind)
      28          18 :       Matches.push_back(Index.getValue());
      29             :   }
      30           1 : }
      31             : 
      32           0 : NativeEnumTypes::NativeEnumTypes(
      33             :     NativeSession &PDBSession, const std::vector<codeview::TypeIndex> &Matches,
      34           0 :     codeview::TypeLeafKind Kind)
      35           0 :     : Matches(Matches), Index(0), Session(PDBSession), Kind(Kind) {}
      36             : 
      37           1 : uint32_t NativeEnumTypes::getChildCount() const {
      38           2 :   return static_cast<uint32_t>(Matches.size());
      39             : }
      40             : 
      41             : std::unique_ptr<PDBSymbol>
      42          10 : NativeEnumTypes::getChildAtIndex(uint32_t Index) const {
      43          20 :   if (Index < Matches.size())
      44          36 :     return Session.createEnumSymbol(Matches[Index]);
      45             :   return nullptr;
      46             : }
      47             : 
      48          10 : std::unique_ptr<PDBSymbol> NativeEnumTypes::getNext() {
      49          10 :   return getChildAtIndex(Index++);
      50             : }
      51             : 
      52           0 : void NativeEnumTypes::reset() { Index = 0; }
      53             : 
      54           0 : NativeEnumTypes *NativeEnumTypes::clone() const {
      55           0 :   return new NativeEnumTypes(Session, Matches, Kind);
      56             : }
      57             : 
      58             : } // namespace pdb
      59             : } // namespace llvm

Generated by: LCOV version 1.13