Bump version to 19.1.0git
[llvm-project.git] / lld / MachO / Dwarf.h
blob31a9f82ee007693875c823dc93130a1a23cfea77
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::macho {
17 class ObjFile;
19 // Implements the interface between LLVM's DWARF-parsing utilities and LLD's
20 // InputSection structures.
21 class DwarfObject final : public llvm::DWARFObject {
22 public:
23 bool isLittleEndian() const override { return true; }
25 std::optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &sec,
26 uint64_t pos) const override {
27 // TODO: implement this
28 return std::nullopt;
31 void forEachInfoSections(
32 llvm::function_ref<void(const llvm::DWARFSection &)> f) const override {
33 f(infoSection);
36 llvm::StringRef getAbbrevSection() const override { return abbrevSection; }
37 llvm::StringRef getStrSection() const override { return strSection; }
39 llvm::DWARFSection const &getLineSection() const override {
40 return lineSection;
43 llvm::DWARFSection const &getStrOffsetsSection() const override {
44 return strOffsSection;
47 // Returns an instance of DwarfObject if the given object file has the
48 // relevant DWARF debug sections.
49 static std::unique_ptr<DwarfObject> create(ObjFile *);
51 private:
52 llvm::DWARFSection infoSection;
53 llvm::DWARFSection lineSection;
54 llvm::DWARFSection strOffsSection;
55 llvm::StringRef abbrevSection;
56 llvm::StringRef strSection;
59 } // namespace lld::macho
61 #endif