| 1 | //===-- ManualDWARFIndexSet.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_MANUALDWARFINDEXSET_H |
| 10 | #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_MANUALDWARFINDEXSET_H |
| 11 | |
| 12 | #include "Plugins/SymbolFile/DWARF/NameToDIE.h" |
| 13 | #include "lldb/Utility/DataEncoder.h" |
| 14 | #include "lldb/Utility/DataExtractor.h" |
| 15 | #include "llvm/ADT/STLExtras.h" |
| 16 | #include <optional> |
| 17 | |
| 18 | namespace lldb_private::plugin::dwarf { |
| 19 | |
| 20 | template <typename T> struct IndexSet { |
| 21 | T function_basenames; |
| 22 | T function_fullnames; |
| 23 | T function_methods; |
| 24 | T function_selectors; |
| 25 | T objc_class_selectors; |
| 26 | T globals; |
| 27 | T types; |
| 28 | T namespaces; |
| 29 | |
| 30 | static std::array<T(IndexSet::*), 8> Indices() { |
| 31 | return {&IndexSet::function_basenames, |
| 32 | &IndexSet::function_fullnames, |
| 33 | &IndexSet::function_methods, |
| 34 | &IndexSet::function_selectors, |
| 35 | &IndexSet::objc_class_selectors, |
| 36 | &IndexSet::globals, |
| 37 | &IndexSet::types, |
| 38 | &IndexSet::namespaces}; |
| 39 | } |
| 40 | |
| 41 | friend bool operator==(const IndexSet &lhs, const IndexSet &rhs) { |
| 42 | return llvm::all_of(Indices(), [&lhs, &rhs](T(IndexSet::*index)) { |
| 43 | return lhs.*index == rhs.*index; |
| 44 | }); |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | std::optional<IndexSet<NameToDIE>> (const DataExtractor &data, |
| 49 | lldb::offset_t *offset_ptr); |
| 50 | void EncodeIndexSet(const IndexSet<NameToDIE> &set, DataEncoder &encoder); |
| 51 | |
| 52 | } // namespace lldb_private::plugin::dwarf |
| 53 | |
| 54 | #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_MANUALDWARFINDEXSET_H |
| 55 | |