Coverage Report

Created: 2018-09-19 08:35

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/DebugInfo/CodeView/Line.h
Line
Count
Source (jump to first uncovered line)
1
//===- Line.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_LINE_H
11
#define LLVM_DEBUGINFO_CODEVIEW_LINE_H
12
13
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
14
#include "llvm/Support/Endian.h"
15
#include <cinttypes>
16
17
namespace llvm {
18
namespace codeview {
19
20
using llvm::support::ulittle32_t;
21
22
class LineInfo {
23
public:
24
  enum : uint32_t {
25
    AlwaysStepIntoLineNumber = 0xfeefee,
26
    NeverStepIntoLineNumber = 0xf00f00
27
  };
28
29
  enum : int { EndLineDeltaShift = 24 };
30
31
  enum : uint32_t {
32
    StartLineMask = 0x00ffffff,
33
    EndLineDeltaMask = 0x7f000000,
34
    StatementFlag = 0x80000000u
35
  };
36
37
  LineInfo(uint32_t StartLine, uint32_t EndLine, bool IsStatement);
38
  LineInfo(uint32_t LineData) : LineData(LineData) {}
39
40
4.15k
  uint32_t getStartLine() const { return LineData & StartLineMask; }
41
42
  uint32_t getLineDelta() const {
43
    return (LineData & EndLineDeltaMask) >> EndLineDeltaShift;
44
  }
45
46
0
  uint32_t getEndLine() const { return getStartLine() + getLineDelta(); }
47
48
  bool isStatement() const { return (LineData & StatementFlag) != 0; }
49
50
  uint32_t getRawData() const { return LineData; }
51
52
1.37k
  bool isAlwaysStepInto() const {
53
1.37k
    return getStartLine() == AlwaysStepIntoLineNumber;
54
1.37k
  }
55
56
1.37k
  bool isNeverStepInto() const {
57
1.37k
    return getStartLine() == NeverStepIntoLineNumber;
58
1.37k
  }
59
60
private:
61
  uint32_t LineData;
62
};
63
64
class ColumnInfo {
65
private:
66
  static const uint32_t StartColumnMask = 0x0000ffffu;
67
  static const uint32_t EndColumnMask = 0xffff0000u;
68
  static const int EndColumnShift = 16;
69
70
public:
71
806
  ColumnInfo(uint16_t StartColumn, uint16_t EndColumn) {
72
806
    ColumnData =
73
806
        (static_cast<uint32_t>(StartColumn) & StartColumnMask) |
74
806
        ((static_cast<uint32_t>(EndColumn) << EndColumnShift) & EndColumnMask);
75
806
  }
76
77
806
  uint16_t getStartColumn() const {
78
806
    return static_cast<uint16_t>(ColumnData & StartColumnMask);
79
806
  }
80
81
  uint16_t getEndColumn() const {
82
    return static_cast<uint16_t>((ColumnData & EndColumnMask) >>
83
                                 EndColumnShift);
84
  }
85
86
  uint32_t getRawData() const { return ColumnData; }
87
88
private:
89
  uint32_t ColumnData;
90
};
91
92
class Line {
93
private:
94
  int32_t CodeOffset;
95
  LineInfo LineInf;
96
  ColumnInfo ColumnInf;
97
98
public:
99
  Line(int32_t CodeOffset, uint32_t StartLine, uint32_t EndLine,
100
       uint16_t StartColumn, uint16_t EndColumn, bool IsStatement)
101
      : CodeOffset(CodeOffset), LineInf(StartLine, EndLine, IsStatement),
102
        ColumnInf(StartColumn, EndColumn) {}
103
104
  Line(int32_t CodeOffset, LineInfo LineInf, ColumnInfo ColumnInf)
105
      : CodeOffset(CodeOffset), LineInf(LineInf), ColumnInf(ColumnInf) {}
106
107
  LineInfo getLineInfo() const { return LineInf; }
108
109
  ColumnInfo getColumnInfo() const { return ColumnInf; }
110
111
  int32_t getCodeOffset() const { return CodeOffset; }
112
113
  uint32_t getStartLine() const { return LineInf.getStartLine(); }
114
115
  uint32_t getLineDelta() const { return LineInf.getLineDelta(); }
116
117
  uint32_t getEndLine() const { return LineInf.getEndLine(); }
118
119
  uint16_t getStartColumn() const { return ColumnInf.getStartColumn(); }
120
121
  uint16_t getEndColumn() const { return ColumnInf.getEndColumn(); }
122
123
  bool isStatement() const { return LineInf.isStatement(); }
124
125
  bool isAlwaysStepInto() const { return LineInf.isAlwaysStepInto(); }
126
127
  bool isNeverStepInto() const { return LineInf.isNeverStepInto(); }
128
};
129
130
} // namespace codeview
131
} // namespace llvm
132
133
#endif