1257752Semaste//===-- DWARFDataExtractor.cpp ----------------------------------*- C++ -*-===//
2257752Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6257752Semaste//
7257752Semaste//===----------------------------------------------------------------------===//
8257752Semaste
9257752Semaste#include "DWARFDataExtractor.h"
10353358Sdim#include "llvm/ADT/StringRef.h"
11257752Semaste
12257752Semastenamespace lldb_private {
13257752Semaste
14257752Semasteuint64_t
15314564SdimDWARFDataExtractor::GetDWARFInitialLength(lldb::offset_t *offset_ptr) const {
16353358Sdim  return GetU32(offset_ptr);
17257752Semaste}
18257752Semaste
19257752Semastedw_offset_t
20314564SdimDWARFDataExtractor::GetDWARFOffset(lldb::offset_t *offset_ptr) const {
21341825Sdim  return GetMaxU64(offset_ptr, GetDWARFSizeOfOffset());
22257752Semaste}
23353358Sdim
24353358Sdimllvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVM() const {
25353358Sdim  return llvm::DWARFDataExtractor(
26353358Sdim      llvm::StringRef(reinterpret_cast<const char *>(GetDataStart()),
27353358Sdim                      GetByteSize()),
28353358Sdim      GetByteOrder() == lldb::eByteOrderLittle, GetAddressByteSize());
29257752Semaste}
30353358Sdim} // namespace lldb_private
31