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