LLVM  9.0.0svn
Line.h
Go to the documentation of this file.
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 
13 #include "llvm/Support/Endian.h"
14 #include <cinttypes>
15 
16 namespace llvm {
17 namespace codeview {
18 
20 
21 class LineInfo {
22 public:
23  enum : uint32_t {
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  uint32_t getStartLine() const { return LineData & StartLineMask; }
40 
42  return (LineData & EndLineDeltaMask) >> EndLineDeltaShift;
43  }
44 
45  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  bool isAlwaysStepInto() const {
53  }
54 
55  bool isNeverStepInto() const {
57  }
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  ColumnInfo(uint16_t StartColumn, uint16_t EndColumn) {
71  ColumnData =
72  (static_cast<uint32_t>(StartColumn) & StartColumnMask) |
73  ((static_cast<uint32_t>(EndColumn) << EndColumnShift) & EndColumnMask);
74  }
75 
76  uint16_t getStartColumn() const {
77  return static_cast<uint16_t>(ColumnData & StartColumnMask);
78  }
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
uint16_t getEndColumn() const
Definition: Line.h:120
bool isStatement() const
Definition: Line.h:122
This class represents lattice values for constants.
Definition: AllocatorList.h:23
uint32_t getStartLine() const
Definition: Line.h:39
bool isNeverStepInto() const
Definition: Line.h:55
bool isAlwaysStepInto() const
Definition: Line.h:124
uint16_t getStartColumn() const
Definition: Line.h:76
Line(int32_t CodeOffset, LineInfo LineInf, ColumnInfo ColumnInf)
Definition: Line.h:103
LineInfo getLineInfo() const
Definition: Line.h:106
int32_t getCodeOffset() const
Definition: Line.h:110
uint32_t getRawData() const
Definition: Line.h:85
uint32_t getEndLine() const
Definition: Line.h:45
ColumnInfo getColumnInfo() const
Definition: Line.h:108
uint32_t getEndLine() const
Definition: Line.h:116
bool isNeverStepInto() const
Definition: Line.h:126
uint32_t getLineDelta() const
Definition: Line.h:41
LineInfo(uint32_t LineData)
Definition: Line.h:37
uint32_t getRawData() const
Definition: Line.h:49
bool isStatement() const
Definition: Line.h:47
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Definition: Endian.h:274
uint16_t getStartColumn() const
Definition: Line.h:118
uint32_t getStartLine() const
Definition: Line.h:112
bool isAlwaysStepInto() const
Definition: Line.h:51
Line(int32_t CodeOffset, uint32_t StartLine, uint32_t EndLine, uint16_t StartColumn, uint16_t EndColumn, bool IsStatement)
Definition: Line.h:98
uint32_t getLineDelta() const
Definition: Line.h:114
LineInfo(uint32_t StartLine, uint32_t EndLine, bool IsStatement)
Definition: Line.cpp:14
uint16_t getEndColumn() const
Definition: Line.h:80
ColumnInfo(uint16_t StartColumn, uint16_t EndColumn)
Definition: Line.h:70