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
12using namespace llvm;
13using namespace llvm::pdb;
14
15NativeLineNumber::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
24uint32_t NativeLineNumber::getLineNumber() const { return Line.getStartLine(); }
25
26uint32_t NativeLineNumber::getLineNumberEnd() const {
27 return Line.getEndLine();
28}
29
30uint32_t NativeLineNumber::getColumnNumber() const { return ColumnNumber; }
31
32uint32_t NativeLineNumber::getColumnNumberEnd() const { return 0; }
33
34uint32_t NativeLineNumber::getAddressSection() const { return Section; }
35
36uint32_t NativeLineNumber::getAddressOffset() const { return Offset; }
37
38uint32_t NativeLineNumber::getRelativeVirtualAddress() const {
39 return Session.getRVAFromSectOffset(Section, Offset);
40}
41
42uint64_t NativeLineNumber::getVirtualAddress() const {
43 return Session.getVAFromSectOffset(Section, Offset);
44}
45
46uint32_t NativeLineNumber::getLength() const { return Length; }
47
48uint32_t NativeLineNumber::getSourceFileId() const { return SrcFileId; }
49
50uint32_t NativeLineNumber::getCompilandId() const { return CompilandId; }
51
52bool NativeLineNumber::isStatement() const { return Line.isStatement(); }
53