1 //===- LineEntry.h ----------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_GSYM_LINEENTRY_H
10 #define LLVM_DEBUGINFO_GSYM_LINEENTRY_H
12 #include "llvm/DebugInfo/GSYM/Range.h"
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.
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; }
31 inline raw_ostream
&operator<<(raw_ostream
&OS
, const LineEntry
&LE
) {
32 return OS
<< "addr=" << HEX64(LE
.Addr
) << ", file=" << format("%3u", LE
.File
)
33 << ", line=" << format("%3u", LE
.Line
);
36 inline bool operator==(const LineEntry
&LHS
, const LineEntry
&RHS
) {
37 return LHS
.Addr
== RHS
.Addr
&& LHS
.File
== RHS
.File
&& LHS
.Line
== RHS
.Line
;
39 inline bool operator!=(const LineEntry
&LHS
, const LineEntry
&RHS
) {
42 inline bool operator<(const LineEntry
&LHS
, const LineEntry
&RHS
) {
43 return LHS
.Addr
< RHS
.Addr
;
47 #endif // #ifndef LLVM_DEBUGINFO_GSYM_LINEENTRY_H