Skip to content

Commit 8e71d14

Browse files
[lldb] Use LLVM's implementation of AppleTables for apple_objc
This concludes the migration of accelerator tables from LLDB code to LLVM code. Differential Revision: https://reviews.llvm.org/D153868
1 parent bdae564 commit 8e71d14

File tree

5 files changed

+7
-507
lines changed

5 files changed

+7
-507
lines changed

lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "lldb/Core/Module.h"
1515
#include "lldb/Symbol/Function.h"
16+
#include "llvm/Support/DJB.h"
1617

1718
using namespace lldb_private;
1819
using namespace lldb;
@@ -35,10 +36,8 @@ std::unique_ptr<AppleDWARFIndex> AppleDWARFIndex::Create(
3536
auto apple_types_table_up = std::make_unique<llvm::AppleAcceleratorTable>(
3637
apple_types.GetAsLLVMDWARF(), llvm_debug_str);
3738

38-
auto apple_objc_table_up = std::make_unique<DWARFMappedHash::MemoryTable>(
39-
apple_objc, debug_str, ".apple_objc");
40-
if (!apple_objc_table_up->IsValid())
41-
apple_objc_table_up.reset();
39+
auto apple_objc_table_up = std::make_unique<llvm::AppleAcceleratorTable>(
40+
apple_objc.GetAsLLVMDWARF(), llvm_debug_str);
4241

4342
auto extract_and_check = [](auto &TablePtr) {
4443
if (auto E = TablePtr->extract()) {
@@ -50,6 +49,7 @@ std::unique_ptr<AppleDWARFIndex> AppleDWARFIndex::Create(
5049
extract_and_check(apple_names_table_up);
5150
extract_and_check(apple_namespaces_table_up);
5251
extract_and_check(apple_types_table_up);
52+
extract_and_check(apple_objc_table_up);
5353

5454
if (apple_names_table_up || apple_namespaces_table_up ||
5555
apple_types_table_up || apple_objc_table_up)
@@ -172,9 +172,7 @@ void AppleDWARFIndex::GetObjCMethods(
172172
ConstString class_name, llvm::function_ref<bool(DWARFDIE die)> callback) {
173173
if (!m_apple_objc_up)
174174
return;
175-
m_apple_objc_up->FindByName(
176-
class_name.GetStringRef(),
177-
DIERefCallback(callback, class_name.GetStringRef()));
175+
SearchFor(*m_apple_objc_up, class_name, callback);
178176
}
179177

180178
void AppleDWARFIndex::GetCompleteObjCClass(

lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H
1111

1212
#include "Plugins/SymbolFile/DWARF/DWARFIndex.h"
13-
#include "Plugins/SymbolFile/DWARF/HashedNameToDIE.h"
1413
#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
1514

1615
namespace lldb_private {
@@ -25,7 +24,7 @@ class AppleDWARFIndex : public DWARFIndex {
2524
std::unique_ptr<llvm::AppleAcceleratorTable> apple_names,
2625
std::unique_ptr<llvm::AppleAcceleratorTable> apple_namespaces,
2726
std::unique_ptr<llvm::AppleAcceleratorTable> apple_types,
28-
std::unique_ptr<DWARFMappedHash::MemoryTable> apple_objc)
27+
std::unique_ptr<llvm::AppleAcceleratorTable> apple_objc)
2928
: DWARFIndex(module), m_apple_names_up(std::move(apple_names)),
3029
m_apple_namespaces_up(std::move(apple_namespaces)),
3130
m_apple_types_up(std::move(apple_types)),
@@ -66,7 +65,7 @@ class AppleDWARFIndex : public DWARFIndex {
6665
std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_names_up;
6766
std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_namespaces_up;
6867
std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_types_up;
69-
std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_objc_up;
68+
std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_objc_up;
7069

7170
/// Search for entries whose name is `name` in `table`, calling `callback` for
7271
/// each match. If `search_for_tag` is provided, ignore entries whose tag is

lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
3131
DWARFIndex.cpp
3232
DWARFTypeUnit.cpp
3333
DWARFUnit.cpp
34-
HashedNameToDIE.cpp
3534
LogChannelDWARF.cpp
3635
ManualDWARFIndex.cpp
3736
NameToDIE.cpp

0 commit comments

Comments
 (0)