1//===-- AppleDWARFIndex.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_APPLEDWARFINDEX_H
10#define LLDB_APPLEDWARFINDEX_H
11
12#include "Plugins/SymbolFile/DWARF/DWARFIndex.h"
13#include "Plugins/SymbolFile/DWARF/HashedNameToDIE.h"
14
15namespace lldb_private {
16class AppleDWARFIndex : public DWARFIndex {
17public:
18  static std::unique_ptr<AppleDWARFIndex>
19  Create(Module &module, DWARFDataExtractor apple_names,
20         DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types,
21         DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str);
22
23  AppleDWARFIndex(
24      Module &module, std::unique_ptr<DWARFMappedHash::MemoryTable> apple_names,
25      std::unique_ptr<DWARFMappedHash::MemoryTable> apple_namespaces,
26      std::unique_ptr<DWARFMappedHash::MemoryTable> apple_types,
27      std::unique_ptr<DWARFMappedHash::MemoryTable> apple_objc)
28      : DWARFIndex(module), m_apple_names_up(std::move(apple_names)),
29        m_apple_namespaces_up(std::move(apple_namespaces)),
30        m_apple_types_up(std::move(apple_types)),
31        m_apple_objc_up(std::move(apple_objc)) {}
32
33  void Preload() override {}
34
35  void GetGlobalVariables(ConstString basename, DIEArray &offsets) override;
36  void GetGlobalVariables(const RegularExpression &regex,
37                          DIEArray &offsets) override;
38  void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
39  void GetObjCMethods(ConstString class_name, DIEArray &offsets) override;
40  void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
41                            DIEArray &offsets) override;
42  void GetTypes(ConstString name, DIEArray &offsets) override;
43  void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
44  void GetNamespaces(ConstString name, DIEArray &offsets) override;
45  void GetFunctions(ConstString name, SymbolFileDWARF &dwarf,
46                    const CompilerDeclContext &parent_decl_ctx,
47                    uint32_t name_type_mask,
48                    std::vector<DWARFDIE> &dies) override;
49  void GetFunctions(const RegularExpression &regex, DIEArray &offsets) override;
50
51  void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override;
52  void Dump(Stream &s) override;
53
54private:
55  std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_names_up;
56  std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_namespaces_up;
57  std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_types_up;
58  std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_objc_up;
59};
60} // namespace lldb_private
61
62#endif // LLDB_APPLEDWARFINDEX_H
63