]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / SymbolFile / DWARF / ManualDWARFIndex.h
1 //===-- ManulaDWARFIndex.h -------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLDB_MANUALDWARFINDEX_H
11 #define LLDB_MANUALDWARFINDEX_H
12
13 #include "Plugins/SymbolFile/DWARF/DWARFIndex.h"
14 #include "Plugins/SymbolFile/DWARF/NameToDIE.h"
15 #include "llvm/ADT/DenseSet.h"
16
17 namespace lldb_private {
18 class ManualDWARFIndex : public DWARFIndex {
19 public:
20   ManualDWARFIndex(Module &module, DWARFDebugInfo *debug_info,
21                    llvm::DenseSet<dw_offset_t> units_to_avoid = {})
22       : DWARFIndex(module), m_debug_info(debug_info),
23         m_units_to_avoid(std::move(units_to_avoid)) {}
24
25   void Preload() override { Index(); }
26
27   void GetGlobalVariables(ConstString basename, DIEArray &offsets) override;
28   void GetGlobalVariables(const RegularExpression &regex,
29                           DIEArray &offsets) override;
30   void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
31   void GetObjCMethods(ConstString class_name, DIEArray &offsets) override;
32   void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
33                             DIEArray &offsets) override;
34   void GetTypes(ConstString name, DIEArray &offsets) override;
35   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
36   void GetNamespaces(ConstString name, DIEArray &offsets) override;
37   void GetFunctions(ConstString name, DWARFDebugInfo &info,
38                     const CompilerDeclContext &parent_decl_ctx,
39                     uint32_t name_type_mask,
40                     std::vector<DWARFDIE> &dies) override;
41   void GetFunctions(const RegularExpression &regex, DIEArray &offsets) override;
42
43   void ReportInvalidDIEOffset(dw_offset_t offset,
44                               llvm::StringRef name) override {}
45   void Dump(Stream &s) override;
46
47 private:
48   struct IndexSet {
49     NameToDIE function_basenames;
50     NameToDIE function_fullnames;
51     NameToDIE function_methods;
52     NameToDIE function_selectors;
53     NameToDIE objc_class_selectors;
54     NameToDIE globals;
55     NameToDIE types;
56     NameToDIE namespaces;
57   };
58   void Index();
59   void IndexUnit(DWARFUnit &unit, IndexSet &set);
60
61   static void
62   IndexUnitImpl(DWARFUnit &unit, const lldb::LanguageType cu_language,
63                 const DWARFFormValue::FixedFormSizes &fixed_form_sizes,
64                 const dw_offset_t cu_offset, IndexSet &set);
65
66   /// Non-null value means we haven't built the index yet.
67   DWARFDebugInfo *m_debug_info;
68   /// Which dwarf units should we skip while building the index.
69   llvm::DenseSet<dw_offset_t> m_units_to_avoid;
70
71   IndexSet m_set;
72 };
73 } // namespace lldb_private
74
75 #endif // LLDB_MANUALDWARFINDEX_H