comparison lld/MachO/Dwarf.h @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents
children c4bab56944e8
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
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 //===-------------------------------------------------------------------===//
8
9 #ifndef LLD_MACHO_DWARF_H
10 #define LLD_MACHO_DWARF_H
11
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/DebugInfo/DWARF/DWARFObject.h"
14
15 namespace lld {
16 namespace macho {
17
18 class ObjFile;
19
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; }
25
26 llvm::Optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &sec,
27 uint64_t pos) const override {
28 // TODO: implement this
29 return llvm::None;
30 }
31
32 void forEachInfoSections(
33 llvm::function_ref<void(const llvm::DWARFSection &)> f) const override {
34 f(infoSection);
35 }
36
37 llvm::StringRef getAbbrevSection() const override { return abbrevSection; }
38 llvm::StringRef getStrSection() const override { return strSection; }
39
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 *);
43
44 private:
45 llvm::DWARFSection infoSection;
46 llvm::StringRef abbrevSection;
47 llvm::StringRef strSection;
48 };
49
50 } // namespace macho
51 } // namespace lld
52
53 #endif