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

          Line data    Source code
       1             : //===- DebugInlineeLinesSubsection.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_DEBUGINLINEELINESSUBSECTION_H
      11             : #define LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
      12             : 
      13             : #include "llvm/ADT/StringRef.h"
      14             : #include "llvm/DebugInfo/CodeView/CodeView.h"
      15             : #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
      16             : #include "llvm/DebugInfo/CodeView/Line.h"
      17             : #include "llvm/DebugInfo/CodeView/TypeIndex.h"
      18             : #include "llvm/Support/BinaryStreamArray.h"
      19             : #include "llvm/Support/BinaryStreamReader.h"
      20             : #include "llvm/Support/BinaryStreamRef.h"
      21             : #include "llvm/Support/Endian.h"
      22             : #include "llvm/Support/Error.h"
      23             : #include <cstdint>
      24             : #include <vector>
      25             : 
      26             : namespace llvm {
      27             : 
      28             : namespace codeview {
      29             : 
      30             : class DebugChecksumsSubsection;
      31             : 
      32             : enum class InlineeLinesSignature : uint32_t {
      33             :   Normal,    // CV_INLINEE_SOURCE_LINE_SIGNATURE
      34             :   ExtraFiles // CV_INLINEE_SOURCE_LINE_SIGNATURE_EX
      35             : };
      36             : 
      37             : struct InlineeSourceLineHeader {
      38             :   TypeIndex Inlinee;                  // ID of the function that was inlined.
      39             :   support::ulittle32_t FileID;        // Offset into FileChecksums subsection.
      40             :   support::ulittle32_t SourceLineNum; // First line of inlined code.
      41             :                                       // If extra files present:
      42             :                                       //   ulittle32_t ExtraFileCount;
      43             :                                       //   ulittle32_t Files[];
      44             : };
      45             : 
      46             : struct InlineeSourceLine {
      47             :   const InlineeSourceLineHeader *Header;
      48             :   FixedStreamArray<support::ulittle32_t> ExtraFiles;
      49             : };
      50             : 
      51             : } // end namespace codeview
      52             : 
      53          17 : template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
      54             :   Error operator()(BinaryStreamRef Stream, uint32_t &Len,
      55             :                    codeview::InlineeSourceLine &Item);
      56             : 
      57             :   bool HasExtraFiles = false;
      58             : };
      59             : 
      60             : namespace codeview {
      61             : 
      62             : class DebugInlineeLinesSubsectionRef final : public DebugSubsectionRef {
      63             :   using LinesArray = VarStreamArray<InlineeSourceLine>;
      64             :   using Iterator = LinesArray::Iterator;
      65             : 
      66             : public:
      67             :   DebugInlineeLinesSubsectionRef();
      68             : 
      69             :   static bool classof(const DebugSubsectionRef *S) {
      70             :     return S->kind() == DebugSubsectionKind::InlineeLines;
      71             :   }
      72             : 
      73             :   Error initialize(BinaryStreamReader Reader);
      74             :   bool hasExtraFiles() const;
      75             : 
      76           1 :   Iterator begin() const { return Lines.begin(); }
      77             :   Iterator end() const { return Lines.end(); }
      78             : 
      79             : private:
      80             :   InlineeLinesSignature Signature;
      81             :   VarStreamArray<InlineeSourceLine> Lines;
      82             : };
      83             : 
      84           2 : class DebugInlineeLinesSubsection final : public DebugSubsection {
      85             : public:
      86           2 :   struct Entry {
      87             :     std::vector<support::ulittle32_t> ExtraFiles;
      88             :     InlineeSourceLineHeader Header;
      89             :   };
      90             : 
      91             :   DebugInlineeLinesSubsection(DebugChecksumsSubsection &Checksums,
      92             :                               bool HasExtraFiles = false);
      93             : 
      94             :   static bool classof(const DebugSubsection *S) {
      95             :     return S->kind() == DebugSubsectionKind::InlineeLines;
      96             :   }
      97             : 
      98             :   Error commit(BinaryStreamWriter &Writer) const override;
      99             :   uint32_t calculateSerializedSize() const override;
     100             : 
     101             :   void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t SourceLine);
     102             :   void addExtraFile(StringRef FileName);
     103             : 
     104             :   bool hasExtraFiles() const { return HasExtraFiles; }
     105             :   void setHasExtraFiles(bool Has) { HasExtraFiles = Has; }
     106             : 
     107             :   std::vector<Entry>::const_iterator begin() const { return Entries.begin(); }
     108             :   std::vector<Entry>::const_iterator end() const { return Entries.end(); }
     109             : 
     110             : private:
     111             :   DebugChecksumsSubsection &Checksums;
     112             :   bool HasExtraFiles = false;
     113             :   uint32_t ExtraFileCount = 0;
     114             :   std::vector<Entry> Entries;
     115             : };
     116             : 
     117             : } // end namespace codeview
     118             : 
     119             : } // end namespace llvm
     120             : 
     121             : #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H

Generated by: LCOV version 1.13