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   /// \{
22   bool isA(const void *ClassID) const override {
23     return ClassID == &ID || SymbolFileDWARF::isA(ClassID);
24   }
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 
44   lldb::offset_t
45   GetVendorDWARFOpcodeSize(const lldb_private::DataExtractor &data,
46                            const lldb::offset_t data_offset,
47                            const uint8_t op) const override;
48 
49   bool ParseVendorDWARFOpcode(
50       uint8_t op, const lldb_private::DataExtractor &opcodes,
51       lldb::offset_t &offset,
52       std::vector<lldb_private::Value> &stack) const override;
53 
54 protected:
55   DIEToTypePtr &GetDIEToType() override;
56 
57   DIEToVariableSP &GetDIEToVariable() override;
58 
59   DIEToClangType &GetForwardDeclDieToClangType() override;
60 
61   ClangTypeToDIE &GetForwardDeclClangTypeToDie() override;
62 
63   UniqueDWARFASTTypeMap &GetUniqueDWARFASTTypeMap() override;
64 
65   lldb::TypeSP
66   FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die) override;
67 
68   lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
69       const DWARFDIE &die, lldb_private::ConstString type_name,
70       bool must_be_implementation) override;
71 
72   SymbolFileDWARF &GetBaseSymbolFile() const { return m_base_symbol_file; }
73 
74   /// If this file contains exactly one compile unit, this function will return
75   /// it. Otherwise it returns nullptr.
76   DWARFCompileUnit *FindSingleCompileUnit();
77 
78   SymbolFileDWARF &m_base_symbol_file;
79 };
80 
81 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARFDWO_H
82