LLVM  6.0.0svn
Line.h
Go to the documentation of this file.
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 
14 #include "llvm/Support/Endian.h"
15 #include <cinttypes>
16 
17 namespace llvm {
18 namespace codeview {
19 
21 
22 class LineInfo {
23 public:
24  enum : uint32_t {
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  uint32_t getStartLine() const { return LineData & StartLineMask; }
41 
43  return (LineData & EndLineDeltaMask) >> EndLineDeltaShift;
44  }
45 
46  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  bool isAlwaysStepInto() const {
54  }
55 
56  bool isNeverStepInto() const {
58  }
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  ColumnInfo(uint16_t StartColumn, uint16_t EndColumn) {
72  ColumnData =
73  (static_cast<uint32_t>(StartColumn) & StartColumnMask) |
74  ((static_cast<uint32_t>(EndColumn) << EndColumnShift) & EndColumnMask);
75  }
76 
77  uint16_t getStartColumn() const {
78  return static_cast<uint16_t>(ColumnData & StartColumnMask);
79  }
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
uint16_t getEndColumn() const
Definition: Line.h:121
bool isStatement() const
Definition: Line.h:123
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
uint32_t getStartLine() const
Definition: Line.h:40
bool isNeverStepInto() const
Definition: Line.h:56
bool isAlwaysStepInto() const
Definition: Line.h:125
uint16_t getStartColumn() const
Definition: Line.h:77
Line(int32_t CodeOffset, LineInfo LineInf, ColumnInfo ColumnInf)
Definition: Line.h:104
LineInfo getLineInfo() const
Definition: Line.h:107
int32_t getCodeOffset() const
Definition: Line.h:111
uint32_t getRawData() const
Definition: Line.h:86
uint32_t getEndLine() const
Definition: Line.h:46
ColumnInfo getColumnInfo() const
Definition: Line.h:109
uint32_t getEndLine() const
Definition: Line.h:117
bool isNeverStepInto() const
Definition: Line.h:127
uint32_t getLineDelta() const
Definition: Line.h:42
LineInfo(uint32_t LineData)
Definition: Line.h:38
uint32_t getRawData() const
Definition: Line.h:50
bool isStatement() const
Definition: Line.h:48
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Definition: Endian.h:271
uint16_t getStartColumn() const
Definition: Line.h:119
uint32_t getStartLine() const
Definition: Line.h:113
bool isAlwaysStepInto() const
Definition: Line.h:52
Line(int32_t CodeOffset, uint32_t StartLine, uint32_t EndLine, uint16_t StartColumn, uint16_t EndColumn, bool IsStatement)
Definition: Line.h:99
uint32_t getLineDelta() const
Definition: Line.h:115
LineInfo(uint32_t StartLine, uint32_t EndLine, bool IsStatement)
Definition: Line.cpp:15
uint16_t getEndColumn() const
Definition: Line.h:81
ColumnInfo(uint16_t StartColumn, uint16_t EndColumn)
Definition: Line.h:71