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
NativeLineNumber(const NativeSession & Session,const codeview::LineInfo Line,uint32_t ColumnNumber,uint32_t Section,uint32_t Offset,uint32_t Length,uint32_t SrcFileId,uint32_t CompilandId)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
getLineNumber() const24 uint32_t NativeLineNumber::getLineNumber() const { return Line.getStartLine(); }
25
getLineNumberEnd() const26 uint32_t NativeLineNumber::getLineNumberEnd() const {
27 return Line.getEndLine();
28 }
29
getColumnNumber() const30 uint32_t NativeLineNumber::getColumnNumber() const { return ColumnNumber; }
31
getColumnNumberEnd() const32 uint32_t NativeLineNumber::getColumnNumberEnd() const { return 0; }
33
getAddressSection() const34 uint32_t NativeLineNumber::getAddressSection() const { return Section; }
35
getAddressOffset() const36 uint32_t NativeLineNumber::getAddressOffset() const { return Offset; }
37
getRelativeVirtualAddress() const38 uint32_t NativeLineNumber::getRelativeVirtualAddress() const {
39 return Session.getRVAFromSectOffset(Section, Offset);
40 }
41
getVirtualAddress() const42 uint64_t NativeLineNumber::getVirtualAddress() const {
43 return Session.getVAFromSectOffset(Section, Offset);
44 }
45
getLength() const46 uint32_t NativeLineNumber::getLength() const { return Length; }
47
getSourceFileId() const48 uint32_t NativeLineNumber::getSourceFileId() const { return SrcFileId; }
49
getCompilandId() const50 uint32_t NativeLineNumber::getCompilandId() const { return CompilandId; }
51
isStatement() const52 bool NativeLineNumber::isStatement() const { return Line.isStatement(); }
53