@@ -52,57 +52,60 @@ std::unique_ptr<AppleDWARFIndex> AppleDWARFIndex::Create(
52
52
return nullptr ;
53
53
}
54
54
55
- void AppleDWARFIndex::GetGlobalVariables (ConstString basename, DIEArray &offsets) {
55
+ void AppleDWARFIndex::GetGlobalVariables (
56
+ ConstString basename, llvm::function_ref<bool (DIERef ref)> callback) {
56
57
if (!m_apple_names_up)
57
58
return ;
58
- m_apple_names_up->FindByName (basename.GetStringRef (), offsets );
59
+ m_apple_names_up->FindByName (basename.GetStringRef (), callback );
59
60
}
60
61
61
- void AppleDWARFIndex::GetGlobalVariables (const RegularExpression ®ex,
62
- DIEArray &offsets) {
62
+ void AppleDWARFIndex::GetGlobalVariables (
63
+ const RegularExpression ®ex,
64
+ llvm::function_ref<bool (DIERef ref)> callback) {
63
65
if (!m_apple_names_up)
64
66
return ;
65
67
66
68
DWARFMappedHash::DIEInfoArray hash_data;
67
- if ( m_apple_names_up->AppendAllDIEsThatMatchingRegex (regex, hash_data))
68
- DWARFMappedHash::ExtractDIEArray (hash_data, offsets );
69
+ m_apple_names_up->AppendAllDIEsThatMatchingRegex (regex, hash_data);
70
+ DWARFMappedHash::ExtractDIEArray (hash_data, callback );
69
71
}
70
72
71
- void AppleDWARFIndex::GetGlobalVariables (const DWARFUnit &cu,
72
- DIEArray &offsets ) {
73
+ void AppleDWARFIndex::GetGlobalVariables (
74
+ const DWARFUnit &cu, llvm::function_ref< bool (DIERef ref)> callback ) {
73
75
if (!m_apple_names_up)
74
76
return ;
75
77
76
78
DWARFMappedHash::DIEInfoArray hash_data;
77
- if ( m_apple_names_up->AppendAllDIEsInRange (cu.GetOffset (),
78
- cu. GetNextUnitOffset (), hash_data))
79
- DWARFMappedHash::ExtractDIEArray (hash_data, offsets );
79
+ m_apple_names_up->AppendAllDIEsInRange (cu.GetOffset (), cu. GetNextUnitOffset (),
80
+ hash_data);
81
+ DWARFMappedHash::ExtractDIEArray (hash_data, callback );
80
82
}
81
83
82
- void AppleDWARFIndex::GetObjCMethods (ConstString class_name,
83
- DIEArray &offsets ) {
84
+ void AppleDWARFIndex::GetObjCMethods (
85
+ ConstString class_name, llvm::function_ref< bool (DIERef ref)> callback ) {
84
86
if (!m_apple_objc_up)
85
87
return ;
86
- m_apple_objc_up->FindByName (class_name.GetStringRef (), offsets );
88
+ m_apple_objc_up->FindByName (class_name.GetStringRef (), callback );
87
89
}
88
90
89
- void AppleDWARFIndex::GetCompleteObjCClass (ConstString class_name,
90
- bool must_be_implementation,
91
- DIEArray &offsets ) {
91
+ void AppleDWARFIndex::GetCompleteObjCClass (
92
+ ConstString class_name, bool must_be_implementation,
93
+ llvm::function_ref< bool (DIERef ref)> callback ) {
92
94
if (!m_apple_types_up)
93
95
return ;
94
96
m_apple_types_up->FindCompleteObjCClassByName (
95
- class_name.GetStringRef (), offsets , must_be_implementation);
97
+ class_name.GetStringRef (), callback , must_be_implementation);
96
98
}
97
99
98
- void AppleDWARFIndex::GetTypes (ConstString name, DIEArray &offsets) {
100
+ void AppleDWARFIndex::GetTypes (ConstString name,
101
+ llvm::function_ref<bool (DIERef ref)> callback) {
99
102
if (!m_apple_types_up)
100
103
return ;
101
- m_apple_types_up->FindByName (name.GetStringRef (), offsets );
104
+ m_apple_types_up->FindByName (name.GetStringRef (), callback );
102
105
}
103
106
104
107
void AppleDWARFIndex::GetTypes (const DWARFDeclContext &context,
105
- DIEArray &offsets ) {
108
+ llvm::function_ref< bool (DIERef ref)> callback ) {
106
109
if (!m_apple_types_up)
107
110
return ;
108
111
@@ -122,7 +125,7 @@ void AppleDWARFIndex::GetTypes(const DWARFDeclContext &context,
122
125
if (log )
123
126
m_module.LogMessage (log , " FindByNameAndTagAndQualifiedNameHash()" );
124
127
m_apple_types_up->FindByNameAndTagAndQualifiedNameHash (
125
- type_name.GetStringRef (), tag, qualified_name_hash, offsets );
128
+ type_name.GetStringRef (), tag, qualified_name_hash, callback );
126
129
return ;
127
130
}
128
131
@@ -136,47 +139,46 @@ void AppleDWARFIndex::GetTypes(const DWARFDeclContext &context,
136
139
if (!has_qualified_name_hash && (context.GetSize () > 1 ) &&
137
140
(context[1 ].tag == DW_TAG_class_type ||
138
141
context[1 ].tag == DW_TAG_structure_type)) {
139
- DIEArray class_matches;
140
- m_apple_types_up->FindByName (context[1 ].name , class_matches);
141
- if (class_matches.empty ())
142
+ if (!m_apple_types_up->FindByName (context[1 ].name ,
143
+ [&](DIERef ref) { return false ; }))
142
144
return ;
143
145
}
144
146
145
147
if (log )
146
148
m_module.LogMessage (log , " FindByNameAndTag()" );
147
- m_apple_types_up->FindByNameAndTag (type_name.GetStringRef (), tag, offsets );
149
+ m_apple_types_up->FindByNameAndTag (type_name.GetStringRef (), tag, callback );
148
150
return ;
149
151
}
150
152
151
- m_apple_types_up->FindByName (type_name.GetStringRef (), offsets );
153
+ m_apple_types_up->FindByName (type_name.GetStringRef (), callback );
152
154
}
153
155
154
- void AppleDWARFIndex::GetNamespaces (ConstString name, DIEArray &offsets) {
156
+ void AppleDWARFIndex::GetNamespaces (
157
+ ConstString name, llvm::function_ref<bool (DIERef ref)> callback) {
155
158
if (!m_apple_namespaces_up)
156
159
return ;
157
- m_apple_namespaces_up->FindByName (name.GetStringRef (), offsets );
160
+ m_apple_namespaces_up->FindByName (name.GetStringRef (), callback );
158
161
}
159
162
160
- void AppleDWARFIndex::GetFunctions (ConstString name, SymbolFileDWARF &dwarf,
161
- const CompilerDeclContext &parent_decl_ctx,
162
- uint32_t name_type_mask,
163
- std::vector<DWARFDIE> &dies) {
164
- DIEArray offsets;
165
- m_apple_names_up->FindByName (name.GetStringRef (), offsets);
166
- for (const DIERef &die_ref : offsets) {
167
- ProcessFunctionDIE (name.GetStringRef (), die_ref, dwarf, parent_decl_ctx,
168
- name_type_mask, dies);
169
- }
163
+ void AppleDWARFIndex::GetFunctions (
164
+ ConstString name, SymbolFileDWARF &dwarf,
165
+ const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask,
166
+ llvm::function_ref<bool (DWARFDIE die)> callback) {
167
+ m_apple_names_up->FindByName (name.GetStringRef (), [&](DIERef die_ref) {
168
+ return ProcessFunctionDIE (name.GetStringRef (), die_ref, dwarf,
169
+ parent_decl_ctx, name_type_mask, callback);
170
+ });
170
171
}
171
172
172
- void AppleDWARFIndex::GetFunctions (const RegularExpression ®ex,
173
- DIEArray &offsets) {
173
+ void AppleDWARFIndex::GetFunctions (
174
+ const RegularExpression ®ex,
175
+ llvm::function_ref<bool (DIERef ref)> callback) {
174
176
if (!m_apple_names_up)
175
177
return ;
176
178
177
179
DWARFMappedHash::DIEInfoArray hash_data;
178
- if ( m_apple_names_up->AppendAllDIEsThatMatchingRegex (regex, hash_data))
179
- DWARFMappedHash::ExtractDIEArray (hash_data, offsets );
180
+ m_apple_names_up->AppendAllDIEsThatMatchingRegex (regex, hash_data);
181
+ DWARFMappedHash::ExtractDIEArray (hash_data, callback );
180
182
}
181
183
182
184
void AppleDWARFIndex::ReportInvalidDIERef (const DIERef &ref,
0 commit comments