xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1 //===-- SymbolFileDWARFDwo.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 LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARFDWO_H
10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARFDWO_H
11 
12 #include "SymbolFileDWARF.h"
13 #include <optional>
14 
15 class SymbolFileDWARFDwo : public SymbolFileDWARF {
16   /// LLVM RTTI support.
17   static char ID;
18 
19 public:
20   /// LLVM RTTI support.
21   /// \{
isA(const void * ClassID)22   bool isA(const void *ClassID) const override {
23     return ClassID == &ID || SymbolFileDWARF::isA(ClassID);
24   }
classof(const SymbolFile * obj)25   static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
26   /// \}
27 
28   SymbolFileDWARFDwo(SymbolFileDWARF &m_base_symbol_file,
29                      lldb::ObjectFileSP objfile, uint32_t id);
30 
31   ~SymbolFileDWARFDwo() override = default;
32 
33   DWARFCompileUnit *GetDWOCompileUnitForHash(uint64_t hash);
34 
35   void GetObjCMethods(lldb_private::ConstString class_name,
36                       llvm::function_ref<bool(DWARFDIE die)> callback) override;
37 
38   llvm::Expected<lldb::TypeSystemSP>
39   GetTypeSystemForLanguage(lldb::LanguageType language) override;
40 
41   DWARFDIE
42   GetDIE(const DIERef &die_ref) override;
43 
GetDwoNum()44   std::optional<uint32_t> GetDwoNum() override { return GetID() >> 32; }
45 
46   lldb::offset_t
47   GetVendorDWARFOpcodeSize(const lldb_private::DataExtractor &data,
48                            const lldb::offset_t data_offset,
49                            const uint8_t op) const override;
50 
51   bool ParseVendorDWARFOpcode(
52       uint8_t op, const lldb_private::DataExtractor &opcodes,
53       lldb::offset_t &offset,
54       std::vector<lldb_private::Value> &stack) const override;
55 
56 protected:
57   DIEToTypePtr &GetDIEToType() override;
58 
59   DIEToVariableSP &GetDIEToVariable() override;
60 
61   DIEToClangType &GetForwardDeclDieToClangType() override;
62 
63   ClangTypeToDIE &GetForwardDeclClangTypeToDie() override;
64 
65   UniqueDWARFASTTypeMap &GetUniqueDWARFASTTypeMap() override;
66 
67   lldb::TypeSP
68   FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die) override;
69 
70   lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
71       const DWARFDIE &die, lldb_private::ConstString type_name,
72       bool must_be_implementation) override;
73 
GetBaseSymbolFile()74   SymbolFileDWARF &GetBaseSymbolFile() const { return m_base_symbol_file; }
75 
76   /// If this file contains exactly one compile unit, this function will return
77   /// it. Otherwise it returns nullptr.
78   DWARFCompileUnit *FindSingleCompileUnit();
79 
80   SymbolFileDWARF &m_base_symbol_file;
81 };
82 
83 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARFDWO_H
84