1 //===- DWARF.h -----------------------------------------------*- C++ -*-===//
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
7 //===-------------------------------------------------------------------===//
9 #ifndef LLD_MACHO_DWARF_H
10 #define LLD_MACHO_DWARF_H
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/DebugInfo/DWARF/DWARFObject.h"
20 // Implements the interface between LLVM's DWARF-parsing utilities and LLD's
21 // InputSection structures.
22 class DwarfObject final
: public llvm::DWARFObject
{
24 bool isLittleEndian() const override
{ return true; }
26 llvm::Optional
<llvm::RelocAddrEntry
> find(const llvm::DWARFSection
&sec
,
27 uint64_t pos
) const override
{
28 // TODO: implement this
32 void forEachInfoSections(
33 llvm::function_ref
<void(const llvm::DWARFSection
&)> f
) const override
{
37 llvm::StringRef
getAbbrevSection() const override
{ return abbrevSection
; }
38 llvm::StringRef
getStrSection() const override
{ return strSection
; }
40 // Returns an instance of DwarfObject if the given object file has the
41 // relevant DWARF debug sections.
42 static std::unique_ptr
<DwarfObject
> create(ObjFile
*);
45 llvm::DWARFSection infoSection
;
46 llvm::StringRef abbrevSection
;
47 llvm::StringRef strSection
;