1351278Sdim//===- LineEntry.h ----------------------------------------------*- C++ -*-===// 2351278Sdim// 3360784Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4360784Sdim// See https://llvm.org/LICENSE.txt for license information. 5360784Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6351278Sdim// 7351278Sdim//===----------------------------------------------------------------------===// 8351278Sdim 9351278Sdim#ifndef LLVM_DEBUGINFO_GSYM_LINEENTRY_H 10351278Sdim#define LLVM_DEBUGINFO_GSYM_LINEENTRY_H 11351278Sdim 12351278Sdim#include "llvm/DebugInfo/GSYM/Range.h" 13351278Sdim 14351278Sdimnamespace llvm { 15351278Sdimnamespace gsym { 16351278Sdim 17351278Sdim/// Line entries are used to encode the line tables in FunctionInfo objects. 18351278Sdim/// They are stored as a sorted vector of these objects and store the 19351278Sdim/// address, file and line of the line table row for a given address. The 20351278Sdim/// size of a line table entry is calculated by looking at the next entry 21351278Sdim/// in the FunctionInfo's vector of entries. 22351278Sdimstruct LineEntry { 23351278Sdim uint64_t Addr; ///< Start address of this line entry. 24351278Sdim uint32_t File; ///< 1 based index of file in FileTable 25351278Sdim uint32_t Line; ///< Source line number. 26351278Sdim LineEntry(uint64_t A = 0, uint32_t F = 0, uint32_t L = 0) 27351278Sdim : Addr(A), File(F), Line(L) {} 28351278Sdim bool isValid() { return File != 0; } 29351278Sdim}; 30351278Sdim 31351278Sdiminline raw_ostream &operator<<(raw_ostream &OS, const LineEntry &LE) { 32351278Sdim return OS << "addr=" << HEX64(LE.Addr) << ", file=" << format("%3u", LE.File) 33351278Sdim << ", line=" << format("%3u", LE.Line); 34351278Sdim} 35351278Sdim 36351278Sdiminline bool operator==(const LineEntry &LHS, const LineEntry &RHS) { 37351278Sdim return LHS.Addr == RHS.Addr && LHS.File == RHS.File && LHS.Line == RHS.Line; 38351278Sdim} 39351278Sdiminline bool operator!=(const LineEntry &LHS, const LineEntry &RHS) { 40351278Sdim return !(LHS == RHS); 41351278Sdim} 42351278Sdiminline bool operator<(const LineEntry &LHS, const LineEntry &RHS) { 43351278Sdim return LHS.Addr < RHS.Addr; 44351278Sdim} 45351278Sdim} // namespace gsym 46351278Sdim} // namespace llvm 47351278Sdim#endif // #ifndef LLVM_DEBUGINFO_GSYM_LINEENTRY_H 48