LLVM  10.0.0svn
LineEntry.h
Go to the documentation of this file.
1 //===- LineEntry.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_GSYM_LINEENTRY_H
10 #define LLVM_DEBUGINFO_GSYM_LINEENTRY_H
11 
13 
14 namespace llvm {
15 namespace gsym {
16 
17 /// Line entries are used to encode the line tables in FunctionInfo objects.
18 /// They are stored as a sorted vector of these objects and store the
19 /// address, file and line of the line table row for a given address. The
20 /// size of a line table entry is calculated by looking at the next entry
21 /// in the FunctionInfo's vector of entries.
22 struct LineEntry {
23  uint64_t Addr; ///< Start address of this line entry.
24  uint32_t File; ///< 1 based index of file in FileTable
25  uint32_t Line; ///< Source line number.
26  LineEntry(uint64_t A = 0, uint32_t F = 0, uint32_t L = 0)
27  : Addr(A), File(F), Line(L) {}
28  bool isValid() { return File != 0; }
29 };
30 
32  return OS << "addr=" << HEX64(LE.Addr) << ", file=" << format("%3u", LE.File)
33  << ", line=" << format("%3u", LE.Line);
34 }
35 
36 inline bool operator==(const LineEntry &LHS, const LineEntry &RHS) {
37  return LHS.Addr == RHS.Addr && LHS.File == RHS.File && LHS.Line == RHS.Line;
38 }
39 inline bool operator!=(const LineEntry &LHS, const LineEntry &RHS) {
40  return !(LHS == RHS);
41 }
42 inline bool operator<(const LineEntry &LHS, const LineEntry &RHS) {
43  return LHS.Addr < RHS.Addr;
44 }
45 } // namespace gsym
46 } // namespace llvm
47 #endif // #ifndef LLVM_DEBUGINFO_GSYM_LINEENTRY_H
#define HEX64(v)
Definition: Range.h:20
This class represents lattice values for constants.
Definition: AllocatorList.h:23
uint64_t Addr
Start address of this line entry.
Definition: LineEntry.h:23
bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS)
Definition: FunctionInfo.h:162
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
Line entries are used to encode the line tables in FunctionInfo objects.
Definition: LineEntry.h:22
F(f)
bool operator<(const FunctionInfo &LHS, const FunctionInfo &RHS)
This sorting will order things consistently by address range first, but then followed by inlining bei...
Definition: FunctionInfo.h:170
uint32_t File
1 based index of file in FileTable
Definition: LineEntry.h:24
bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS)
Definition: FunctionInfo.h:158
LineEntry(uint64_t A=0, uint32_t F=0, uint32_t L=0)
Definition: LineEntry.h:26
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
uint32_t Line
Source line number.
Definition: LineEntry.h:25
raw_ostream & operator<<(raw_ostream &OS, const FunctionInfo &R)