LCOV - code coverage report
Current view: top level - lib/DebugInfo/CodeView - CVTypeDumper.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 20 27 74.1 %
Date: 2017-05-19 15:56:23 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- CVTypeDumper.cpp - CodeView type info dumper ------------*- 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/CVTypeDumper.h"
      11             : #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
      12             : #include "llvm/DebugInfo/CodeView/TypeDatabase.h"
      13             : #include "llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h"
      14             : #include "llvm/DebugInfo/CodeView/TypeRecord.h"
      15             : #include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h"
      16             : #include "llvm/Support/BinaryByteStream.h"
      17             : 
      18             : using namespace llvm;
      19             : using namespace llvm::codeview;
      20             : 
      21           0 : Error CVTypeDumper::dump(const CVType &Record, TypeVisitorCallbacks &Dumper) {
      22           0 :   TypeDatabaseVisitor DBV(TypeDB);
      23           0 :   TypeVisitorCallbackPipeline Pipeline;
      24           0 :   Pipeline.addCallbackToPipeline(DBV);
      25           0 :   Pipeline.addCallbackToPipeline(Dumper);
      26             : 
      27             :   CVType RecordCopy = Record;
      28             :   return codeview::visitTypeRecord(RecordCopy, Pipeline, VDS_BytesPresent,
      29           0 :                                    Handler);
      30             : }
      31             : 
      32         281 : Error CVTypeDumper::dump(const CVTypeArray &Types,
      33             :                          TypeVisitorCallbacks &Dumper) {
      34         843 :   TypeDatabaseVisitor DBV(TypeDB);
      35         562 :   TypeVisitorCallbackPipeline Pipeline;
      36         281 :   Pipeline.addCallbackToPipeline(DBV);
      37         281 :   Pipeline.addCallbackToPipeline(Dumper);
      38             : 
      39         562 :   return codeview::visitTypeStream(Types, Pipeline, Handler);
      40             : }
      41             : 
      42         281 : Error CVTypeDumper::dump(ArrayRef<uint8_t> Data, TypeVisitorCallbacks &Dumper) {
      43         562 :   BinaryByteStream Stream(Data, llvm::support::little);
      44         562 :   CVTypeArray Types;
      45         562 :   BinaryStreamReader Reader(Stream);
      46         843 :   if (auto EC = Reader.readArray(Types, Reader.getLength()))
      47           0 :     return EC;
      48             : 
      49         281 :   return dump(Types, Dumper);
      50             : }
      51             : 
      52        7374 : void CVTypeDumper::printTypeIndex(ScopedPrinter &Printer, StringRef FieldName,
      53             :                                   TypeIndex TI, TypeDatabase &DB) {
      54        7374 :   StringRef TypeName;
      55        7374 :   if (!TI.isNoneType())
      56        5844 :     TypeName = DB.getTypeName(TI);
      57        7374 :   if (!TypeName.empty())
      58        5691 :     Printer.printHex(FieldName, TypeName, TI.getIndex());
      59             :   else
      60        1683 :     Printer.printHex(FieldName, TI.getIndex());
      61        7374 : }

Generated by: LCOV version 1.13