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