NativeLineNumber.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h"
  9. #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
  10. using namespace llvm;
  11. using namespace llvm::pdb;
  12. NativeLineNumber::NativeLineNumber(const NativeSession &Session,
  13. const codeview::LineInfo Line,
  14. uint32_t ColumnNumber, uint32_t Section,
  15. uint32_t Offset, uint32_t Length,
  16. uint32_t SrcFileId, uint32_t CompilandId)
  17. : Session(Session), Line(Line), ColumnNumber(ColumnNumber),
  18. Section(Section), Offset(Offset), Length(Length), SrcFileId(SrcFileId),
  19. CompilandId(CompilandId) {}
  20. uint32_t NativeLineNumber::getLineNumber() const { return Line.getStartLine(); }
  21. uint32_t NativeLineNumber::getLineNumberEnd() const {
  22. return Line.getEndLine();
  23. }
  24. uint32_t NativeLineNumber::getColumnNumber() const { return ColumnNumber; }
  25. uint32_t NativeLineNumber::getColumnNumberEnd() const { return 0; }
  26. uint32_t NativeLineNumber::getAddressSection() const { return Section; }
  27. uint32_t NativeLineNumber::getAddressOffset() const { return Offset; }
  28. uint32_t NativeLineNumber::getRelativeVirtualAddress() const {
  29. return Session.getRVAFromSectOffset(Section, Offset);
  30. }
  31. uint64_t NativeLineNumber::getVirtualAddress() const {
  32. return Session.getVAFromSectOffset(Section, Offset);
  33. }
  34. uint32_t NativeLineNumber::getLength() const { return Length; }
  35. uint32_t NativeLineNumber::getSourceFileId() const { return SrcFileId; }
  36. uint32_t NativeLineNumber::getCompilandId() const { return CompilandId; }
  37. bool NativeLineNumber::isStatement() const { return Line.isStatement(); }