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