[NFC] Add extra test for D106331
[llvm-project.git] / lld / MachO / Dwarf.h
blob119f2778fc6bcffd127612636cb8ef9b5bd2ec6b
1 //===- DWARF.h -----------------------------------------------*- 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 //===-------------------------------------------------------------------===//
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"
15 namespace lld {
16 namespace macho {
18 class ObjFile;
20 // Implements the interface between LLVM's DWARF-parsing utilities and LLD's
21 // InputSection structures.
22 class DwarfObject final : public llvm::DWARFObject {
23 public:
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
29 return llvm::None;
32 void forEachInfoSections(
33 llvm::function_ref<void(const llvm::DWARFSection &)> f) const override {
34 f(infoSection);
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 *);
44 private:
45 llvm::DWARFSection infoSection;
46 llvm::StringRef abbrevSection;
47 llvm::StringRef strSection;
50 } // namespace macho
51 } // namespace lld
53 #endif