@@ -152,17 +152,17 @@ DWARFDIE DebugNamesDWARFIndex::GetDIE(const DebugNames::Entry &entry) const {
152
152
return DWARFDIE ();
153
153
}
154
154
155
- bool DebugNamesDWARFIndex::ProcessEntry (
155
+ IterationAction DebugNamesDWARFIndex::ProcessEntry (
156
156
const DebugNames::Entry &entry,
157
- llvm::function_ref<bool (DWARFDIE die)> callback) {
157
+ llvm::function_ref<IterationAction (DWARFDIE die)> callback) {
158
158
DWARFDIE die = GetDIE (entry);
159
159
if (!die)
160
- return true ;
160
+ return IterationAction::Continue ;
161
161
// Clang used to erroneously emit index entries for declaration DIEs in case
162
162
// when the definition is in a type unit (llvm.org/pr77696).
163
163
if (die.IsStructUnionOrClass () &&
164
164
die.GetAttributeValueAsUnsigned (DW_AT_declaration, 0 ))
165
- return true ;
165
+ return IterationAction::Continue ;
166
166
return callback (die);
167
167
}
168
168
@@ -185,7 +185,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
185
185
if (entry.tag () != DW_TAG_variable)
186
186
continue ;
187
187
188
- if (! ProcessEntry (entry, IterationActionAdaptor ( callback)) )
188
+ if (ProcessEntry (entry, callback) == IterationAction::Stop )
189
189
return ;
190
190
}
191
191
@@ -207,7 +207,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
207
207
if (entry_or->tag () != DW_TAG_variable)
208
208
continue ;
209
209
210
- if (! ProcessEntry (*entry_or, IterationActionAdaptor ( callback)) )
210
+ if (ProcessEntry (*entry_or, callback) == IterationAction::Stop )
211
211
return ;
212
212
}
213
213
MaybeLogLookupError (entry_or.takeError (), ni, nte.getString ());
@@ -243,7 +243,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
243
243
continue ;
244
244
245
245
found_entry_for_cu = true ;
246
- if (! ProcessEntry (*entry_or, IterationActionAdaptor ( callback)) )
246
+ if (ProcessEntry (*entry_or, callback) == IterationAction::Stop )
247
247
return ;
248
248
}
249
249
MaybeLogLookupError (entry_or.takeError (), ni, nte.getString ());
@@ -358,16 +358,15 @@ void DebugNamesDWARFIndex::GetFullyQualifiedType(
358
358
359
359
if (!parent_chain) {
360
360
// Fallback: use the base class implementation.
361
- if (!ProcessEntry (entry, IterationActionAdaptor ([&](DWARFDIE die) {
362
- return GetFullyQualifiedTypeImpl (context, die,
363
- callback);
364
- })))
361
+ if (ProcessEntry (entry, [&](DWARFDIE die) {
362
+ return GetFullyQualifiedTypeImpl (context, die, callback);
363
+ }) == IterationAction::Stop)
365
364
return ;
366
365
continue ;
367
366
}
368
367
369
368
if (SameParentChain (parent_names, *parent_chain)) {
370
- if (! ProcessEntry (entry, IterationActionAdaptor ( callback)) )
369
+ if (ProcessEntry (entry, callback) == IterationAction::Stop )
371
370
return ;
372
371
}
373
372
}
@@ -462,7 +461,7 @@ void DebugNamesDWARFIndex::GetTypes(
462
461
for (const DebugNames::Entry &entry :
463
462
m_debug_names_up->equal_range (name.GetStringRef ())) {
464
463
if (isType (entry.tag ())) {
465
- if (! ProcessEntry (entry, IterationActionAdaptor ( callback)) )
464
+ if (ProcessEntry (entry, callback) == IterationAction::Stop )
466
465
return ;
467
466
}
468
467
}
@@ -476,7 +475,7 @@ void DebugNamesDWARFIndex::GetTypes(
476
475
auto name = context[0 ].name ;
477
476
for (const DebugNames::Entry &entry : m_debug_names_up->equal_range (name)) {
478
477
if (entry.tag () == context[0 ].tag ) {
479
- if (! ProcessEntry (entry, IterationActionAdaptor ( callback)) )
478
+ if (ProcessEntry (entry, callback) == IterationAction::Stop )
480
479
return ;
481
480
}
482
481
}
@@ -492,7 +491,7 @@ void DebugNamesDWARFIndex::GetNamespaces(
492
491
llvm::dwarf::Tag entry_tag = entry.tag ();
493
492
if (entry_tag == DW_TAG_namespace ||
494
493
entry_tag == DW_TAG_imported_declaration) {
495
- if (! ProcessEntry (entry, IterationActionAdaptor ( callback)) )
494
+ if (ProcessEntry (entry, callback) == IterationAction::Stop )
496
495
return ;
497
496
}
498
497
}
@@ -549,21 +548,20 @@ void DebugNamesDWARFIndex::GetTypesWithQuery(
549
548
getParentChain (entry);
550
549
if (!parent_chain) {
551
550
// Fallback: use the base class implementation.
552
- if (! ProcessEntry (entry, IterationActionAdaptor ( [&](DWARFDIE die) {
553
- return ProcessTypeDIEMatchQuery (query, die, callback);
554
- })) )
551
+ if (ProcessEntry (entry, [&](DWARFDIE die) {
552
+ return ProcessTypeDIEMatchQuery (query, die, callback);
553
+ }) == IterationAction::Stop )
555
554
return ;
556
555
continue ;
557
556
}
558
557
559
558
if (WithinParentChain (parent_contexts, *parent_chain)) {
560
- if (!ProcessEntry (entry, IterationActionAdaptor ([&](DWARFDIE die) {
561
- // After .debug_names filtering still sending to base
562
- // class for further filtering before calling the
563
- // callback.
564
- return ProcessTypeDIEMatchQuery (query, die, callback);
565
- })))
566
- // If the callback returns false, we're done.
559
+ if (ProcessEntry (entry, [&](DWARFDIE die) {
560
+ // After .debug_names filtering still sending to base
561
+ // class for further filtering before calling the
562
+ // callback.
563
+ return ProcessTypeDIEMatchQuery (query, die, callback);
564
+ }) == IterationAction::Stop)
567
565
return ;
568
566
}
569
567
}
@@ -588,23 +586,22 @@ void DebugNamesDWARFIndex::GetNamespacesWithParents(
588
586
getParentChain (entry);
589
587
if (!parent_chain) {
590
588
// Fallback: use the base class implementation.
591
- if (! ProcessEntry (entry, IterationActionAdaptor ( [&](DWARFDIE die) {
592
- return ProcessNamespaceDieMatchParents (
593
- parent_decl_ctx, die, callback);
594
- })) )
589
+ if (ProcessEntry (entry, [&](DWARFDIE die) {
590
+ return ProcessNamespaceDieMatchParents (parent_decl_ctx, die,
591
+ callback);
592
+ }) == IterationAction::Stop )
595
593
return ;
596
594
continue ;
597
595
}
598
596
599
597
if (WithinParentChain (parent_named_contexts, *parent_chain)) {
600
- if (!ProcessEntry (entry, IterationActionAdaptor ([&](DWARFDIE die) {
601
- // After .debug_names filtering still sending to
602
- // base class for further filtering before calling
603
- // the callback.
604
- return ProcessNamespaceDieMatchParents (
605
- parent_decl_ctx, die, callback);
606
- })))
607
- // If the callback returns false, we're done.
598
+ if (ProcessEntry (entry, [&](DWARFDIE die) {
599
+ // After .debug_names filtering still sending to
600
+ // base class for further filtering before calling
601
+ // the callback.
602
+ return ProcessNamespaceDieMatchParents (parent_decl_ctx, die,
603
+ callback);
604
+ }) == IterationAction::Stop)
608
605
return ;
609
606
}
610
607
}
@@ -653,7 +650,7 @@ void DebugNamesDWARFIndex::GetFunctions(
653
650
if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine)
654
651
continue ;
655
652
656
- if (! ProcessEntry (*entry_or, IterationActionAdaptor ( callback)) )
653
+ if (ProcessEntry (*entry_or, callback) == IterationAction::Stop )
657
654
return ;
658
655
}
659
656
MaybeLogLookupError (entry_or.takeError (), ni, nte.getString ());
0 commit comments