brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 7fb5742 Raw
55 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_MANUALDWARFINDEXSET_H10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_MANUALDWARFINDEXSET_H11 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 18namespace lldb_private::plugin::dwarf {19 20template <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 48std::optional<IndexSet<NameToDIE>> DecodeIndexSet(const DataExtractor &data,49                                                  lldb::offset_t *offset_ptr);50void EncodeIndexSet(const IndexSet<NameToDIE> &set, DataEncoder &encoder);51 52} // namespace lldb_private::plugin::dwarf53 54#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_MANUALDWARFINDEXSET_H55