1 //===- NativeLineNumber.cpp - Native line number implementation -*- 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 #include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h" 10 #include "llvm/DebugInfo/PDB/Native/NativeSession.h" 11 12 using namespace llvm; 13 using namespace llvm::pdb; 14 15 NativeLineNumber::NativeLineNumber(const NativeSession &Session, 16 const codeview::LineInfo Line, 17 uint32_t ColumnNumber, uint32_t Section, 18 uint32_t Offset, uint32_t Length, 19 uint32_t SrcFileId, uint32_t CompilandId) 20 : Session(Session), Line(Line), ColumnNumber(ColumnNumber), 21 Section(Section), Offset(Offset), Length(Length), SrcFileId(SrcFileId), 22 CompilandId(CompilandId) {} 23 24 uint32_t NativeLineNumber::getLineNumber() const { return Line.getStartLine(); } 25 26 uint32_t NativeLineNumber::getLineNumberEnd() const { 27 return Line.getEndLine(); 28 } 29 30 uint32_t NativeLineNumber::getColumnNumber() const { return ColumnNumber; } 31 32 uint32_t NativeLineNumber::getColumnNumberEnd() const { return 0; } 33 34 uint32_t NativeLineNumber::getAddressSection() const { return Section; } 35 36 uint32_t NativeLineNumber::getAddressOffset() const { return Offset; } 37 38 uint32_t NativeLineNumber::getRelativeVirtualAddress() const { 39 return Session.getRVAFromSectOffset(Section, Offset); 40 } 41 42 uint64_t NativeLineNumber::getVirtualAddress() const { 43 return Session.getVAFromSectOffset(Section, Offset); 44 } 45 46 uint32_t NativeLineNumber::getLength() const { return Length; } 47 48 uint32_t NativeLineNumber::getSourceFileId() const { return SrcFileId; } 49 50 uint32_t NativeLineNumber::getCompilandId() const { return CompilandId; } 51 52 bool NativeLineNumber::isStatement() const { return Line.isStatement(); } 53