LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/CodeView - MergingTypeTableBuilder.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2018-10-20 13:21:21 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- MergingTypeTableBuilder.h ---------------------------------*- 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             : #ifndef LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
      11             : #define LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
      12             : 
      13             : #include "llvm/ADT/ArrayRef.h"
      14             : #include "llvm/ADT/DenseSet.h"
      15             : #include "llvm/ADT/SmallVector.h"
      16             : #include "llvm/DebugInfo/CodeView/CodeView.h"
      17             : #include "llvm/DebugInfo/CodeView/SimpleTypeSerializer.h"
      18             : #include "llvm/DebugInfo/CodeView/TypeCollection.h"
      19             : #include "llvm/DebugInfo/CodeView/TypeHashing.h"
      20             : #include "llvm/DebugInfo/CodeView/TypeIndex.h"
      21             : #include "llvm/Support/Allocator.h"
      22             : #include <cassert>
      23             : #include <cstdint>
      24             : #include <memory>
      25             : #include <vector>
      26             : 
      27             : namespace llvm {
      28             : namespace codeview {
      29             : 
      30             : class ContinuationRecordBuilder;
      31             : 
      32       12368 : class MergingTypeTableBuilder : public TypeCollection {
      33             :   /// Storage for records.  These need to outlive the TypeTableBuilder.
      34             :   BumpPtrAllocator &RecordStorage;
      35             : 
      36             :   /// A serializer that can write non-continuation leaf types.  Only used as
      37             :   /// a convenience function so that we can provide an interface method to
      38             :   /// write an unserialized record.
      39             :   SimpleTypeSerializer SimpleSerializer;
      40             : 
      41             :   /// Hash table.
      42             :   DenseMap<LocallyHashedType, TypeIndex> HashedRecords;
      43             : 
      44             :   /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
      45             :   SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
      46             : 
      47             : public:
      48             :   explicit MergingTypeTableBuilder(BumpPtrAllocator &Storage);
      49             :   ~MergingTypeTableBuilder();
      50             : 
      51             :   // TypeTableCollection overrides
      52             :   Optional<TypeIndex> getFirst() override;
      53             :   Optional<TypeIndex> getNext(TypeIndex Prev) override;
      54             :   CVType getType(TypeIndex Index) override;
      55             :   StringRef getTypeName(TypeIndex Index) override;
      56             :   bool contains(TypeIndex Index) override;
      57             :   uint32_t size() override;
      58             :   uint32_t capacity() override;
      59             : 
      60             :   // public interface
      61             :   void reset();
      62             :   TypeIndex nextTypeIndex() const;
      63             : 
      64             :   BumpPtrAllocator &getAllocator() { return RecordStorage; }
      65             : 
      66             :   ArrayRef<ArrayRef<uint8_t>> records() const;
      67             : 
      68             :   TypeIndex insertRecordAs(hash_code Hash, ArrayRef<uint8_t> &Record);
      69             :   TypeIndex insertRecordBytes(ArrayRef<uint8_t> &Record);
      70             :   TypeIndex insertRecord(ContinuationRecordBuilder &Builder);
      71             : 
      72             :   template <typename T> TypeIndex writeLeafType(T &Record) {
      73             :     ArrayRef<uint8_t> Data = SimpleSerializer.serialize(Record);
      74             :     return insertRecordBytes(Data);
      75             :   }
      76             : };
      77             : 
      78             : } // end namespace codeview
      79             : } // end namespace llvm
      80             : 
      81             : #endif // LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H

Generated by: LCOV version 1.13