Coverage Report

Created: 2019-02-15 18:59

/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
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_DEBUGINFO_CODEVIEW_LINE_H
10
#define LLVM_DEBUGINFO_CODEVIEW_LINE_H
11
12
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
13
#include "llvm/Support/Endian.h"
14
#include <cinttypes>
15
16
namespace llvm {
17
namespace codeview {
18
19
using llvm::support::ulittle32_t;
20
21
class LineInfo {
22
public:
23
  enum : uint32_t {
24
    AlwaysStepIntoLineNumber = 0xfeefee,
25
    NeverStepIntoLineNumber = 0xf00f00
26
  };
27
28
  enum : int { EndLineDeltaShift = 24 };
29
30
  enum : uint32_t {
31
    StartLineMask = 0x00ffffff,
32
    EndLineDeltaMask = 0x7f000000,
33
    StatementFlag = 0x80000000u
34
  };
35
36
  LineInfo(uint32_t StartLine, uint32_t EndLine, bool IsStatement);
37
  LineInfo(uint32_t LineData) : LineData(LineData) {}
38
39
4.56k
  uint32_t getStartLine() const { return LineData & StartLineMask; }
40
41
  uint32_t getLineDelta() const {
42
    return (LineData & EndLineDeltaMask) >> EndLineDeltaShift;
43
  }
44
45
0
  uint32_t getEndLine() const { return getStartLine() + getLineDelta(); }
46
47
  bool isStatement() const { return (LineData & StatementFlag) != 0; }
48
49
  uint32_t getRawData() const { return LineData; }
50
51
1.50k
  bool isAlwaysStepInto() const {
52
1.50k
    return getStartLine() == AlwaysStepIntoLineNumber;
53
1.50k
  }
54
55
1.50k
  bool isNeverStepInto() const {
56
1.50k
    return getStartLine() == NeverStepIntoLineNumber;
57
1.50k
  }
58
59
private:
60
  uint32_t LineData;
61
};
62
63
class ColumnInfo {
64
private:
65
  static const uint32_t StartColumnMask = 0x0000ffffu;
66
  static const uint32_t EndColumnMask = 0xffff0000u;
67
  static const int EndColumnShift = 16;
68
69
public:
70
896
  ColumnInfo(uint16_t StartColumn, uint16_t EndColumn) {
71
896
    ColumnData =
72
896
        (static_cast<uint32_t>(StartColumn) & StartColumnMask) |
73
896
        ((static_cast<uint32_t>(EndColumn) << EndColumnShift) & EndColumnMask);
74
896
  }
75
76
896
  uint16_t getStartColumn() const {
77
896
    return static_cast<uint16_t>(ColumnData & StartColumnMask);
78
896
  }
79
80
  uint16_t getEndColumn() const {
81
    return static_cast<uint16_t>((ColumnData & EndColumnMask) >>
82
                                 EndColumnShift);
83
  }
84
85
  uint32_t getRawData() const { return ColumnData; }
86
87
private:
88
  uint32_t ColumnData;
89
};
90
91
class Line {
92
private:
93
  int32_t CodeOffset;
94
  LineInfo LineInf;
95
  ColumnInfo ColumnInf;
96
97
public:
98
  Line(int32_t CodeOffset, uint32_t StartLine, uint32_t EndLine,
99
       uint16_t StartColumn, uint16_t EndColumn, bool IsStatement)
100
      : CodeOffset(CodeOffset), LineInf(StartLine, EndLine, IsStatement),
101
        ColumnInf(StartColumn, EndColumn) {}
102
103
  Line(int32_t CodeOffset, LineInfo LineInf, ColumnInfo ColumnInf)
104
      : CodeOffset(CodeOffset), LineInf(LineInf), ColumnInf(ColumnInf) {}
105
106
  LineInfo getLineInfo() const { return LineInf; }
107
108
  ColumnInfo getColumnInfo() const { return ColumnInf; }
109
110
  int32_t getCodeOffset() const { return CodeOffset; }
111
112
  uint32_t getStartLine() const { return LineInf.getStartLine(); }
113
114
  uint32_t getLineDelta() const { return LineInf.getLineDelta(); }
115
116
  uint32_t getEndLine() const { return LineInf.getEndLine(); }
117
118
  uint16_t getStartColumn() const { return ColumnInf.getStartColumn(); }
119
120
  uint16_t getEndColumn() const { return ColumnInf.getEndColumn(); }
121
122
  bool isStatement() const { return LineInf.isStatement(); }
123
124
  bool isAlwaysStepInto() const { return LineInf.isAlwaysStepInto(); }
125
126
  bool isNeverStepInto() const { return LineInf.isNeverStepInto(); }
127
};
128
129
} // namespace codeview
130
} // namespace llvm
131
132
#endif