@@ -720,7 +720,7 @@ bool SymbolFileDWARFDebugMap::ParseDebugMacros(CompileUnit &comp_unit) {
720
720
721
721
void SymbolFileDWARFDebugMap::ForEachSymbolFile (
722
722
std::string description,
723
- std::function<IterationAction(SymbolFileDWARF * )> closure) {
723
+ std::function<IterationAction(SymbolFileDWARF & )> closure) {
724
724
const size_t num_oso_idxs = m_compile_unit_infos.size ();
725
725
const size_t update_rate = std::max<size_t >(1 , num_oso_idxs / 100 );
726
726
Progress progress (std::move (description), " " , num_oso_idxs);
@@ -733,7 +733,9 @@ void SymbolFileDWARFDebugMap::ForEachSymbolFile(
733
733
.GetFilename ()
734
734
.GetString ()
735
735
: std::string ());
736
- if (closure (oso_dwarf) == IterationAction::Stop)
736
+ if (!oso_dwarf)
737
+ continue ;
738
+ if (closure (*oso_dwarf) == IterationAction::Stop)
737
739
return ;
738
740
}
739
741
}
@@ -827,9 +829,9 @@ SymbolFileDWARFDebugMap::GetDynamicArrayInfoForUID(
827
829
bool SymbolFileDWARFDebugMap::CompleteType (CompilerType &compiler_type) {
828
830
bool success = false ;
829
831
if (compiler_type) {
830
- ForEachSymbolFile (" Completing type" , [&](SymbolFileDWARF * oso_dwarf) {
831
- if (oso_dwarf-> HasForwardDeclForCompilerType (compiler_type)) {
832
- oso_dwarf-> CompleteType (compiler_type);
832
+ ForEachSymbolFile (" Completing type" , [&](SymbolFileDWARF & oso_dwarf) {
833
+ if (oso_dwarf. HasForwardDeclForCompilerType (compiler_type)) {
834
+ oso_dwarf. CompleteType (compiler_type);
833
835
success = true ;
834
836
return IterationAction::Stop;
835
837
}
@@ -948,18 +950,17 @@ void SymbolFileDWARFDebugMap::FindGlobalVariables(
948
950
uint32_t total_matches = 0 ;
949
951
950
952
ForEachSymbolFile (
951
- " Looking up global variables" , [&](SymbolFileDWARF * oso_dwarf) {
953
+ " Looking up global variables" , [&](SymbolFileDWARF & oso_dwarf) {
952
954
const uint32_t old_size = variables.GetSize ();
953
- oso_dwarf-> FindGlobalVariables (name, parent_decl_ctx, max_matches,
954
- variables);
955
+ oso_dwarf. FindGlobalVariables (name, parent_decl_ctx, max_matches,
956
+ variables);
955
957
const uint32_t oso_matches = variables.GetSize () - old_size;
956
958
if (oso_matches > 0 ) {
957
959
total_matches += oso_matches;
958
960
959
- // Are we getting all matches?
961
+ // If we are getting all matches, keep going.
960
962
if (max_matches == UINT32_MAX)
961
- return IterationAction::Continue; // Yep, continue getting
962
- // everything
963
+ return IterationAction::Continue;
963
964
964
965
// If we have found enough matches, lets get out
965
966
if (max_matches >= total_matches)
@@ -980,18 +981,17 @@ void SymbolFileDWARFDebugMap::FindGlobalVariables(
980
981
std::lock_guard<std::recursive_mutex> guard (GetModuleMutex ());
981
982
uint32_t total_matches = 0 ;
982
983
ForEachSymbolFile (
983
- " Looking up global variables" , [&](SymbolFileDWARF * oso_dwarf) {
984
+ " Looking up global variables" , [&](SymbolFileDWARF & oso_dwarf) {
984
985
const uint32_t old_size = variables.GetSize ();
985
- oso_dwarf-> FindGlobalVariables (regex, max_matches, variables);
986
+ oso_dwarf. FindGlobalVariables (regex, max_matches, variables);
986
987
987
988
const uint32_t oso_matches = variables.GetSize () - old_size;
988
989
if (oso_matches > 0 ) {
989
990
total_matches += oso_matches;
990
991
991
- // Are we getting all matches?
992
+ // If we are getting all matches, keep going.
992
993
if (max_matches == UINT32_MAX)
993
- return IterationAction::Continue; // Yep, continue getting
994
- // everything
994
+ return IterationAction::Continue;
995
995
996
996
// If we have found enough matches, lets get out
997
997
if (max_matches >= total_matches)
@@ -1106,10 +1106,10 @@ void SymbolFileDWARFDebugMap::FindFunctions(
1106
1106
LLDB_SCOPED_TIMERF (" SymbolFileDWARFDebugMap::FindFunctions (name = %s)" ,
1107
1107
lookup_info.GetLookupName ().GetCString ());
1108
1108
1109
- ForEachSymbolFile (" Looking up functions" , [&](SymbolFileDWARF * oso_dwarf) {
1109
+ ForEachSymbolFile (" Looking up functions" , [&](SymbolFileDWARF & oso_dwarf) {
1110
1110
uint32_t sc_idx = sc_list.GetSize ();
1111
- oso_dwarf-> FindFunctions (lookup_info, parent_decl_ctx, include_inlines,
1112
- sc_list);
1111
+ oso_dwarf. FindFunctions (lookup_info, parent_decl_ctx, include_inlines,
1112
+ sc_list);
1113
1113
if (!sc_list.IsEmpty ()) {
1114
1114
RemoveFunctionsWithModuleNotEqualTo (m_objfile_sp->GetModule (), sc_list,
1115
1115
sc_idx);
@@ -1125,10 +1125,10 @@ void SymbolFileDWARFDebugMap::FindFunctions(const RegularExpression ®ex,
1125
1125
LLDB_SCOPED_TIMERF (" SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')" ,
1126
1126
regex.GetText ().str ().c_str ());
1127
1127
1128
- ForEachSymbolFile (" Looking up functions" , [&](SymbolFileDWARF * oso_dwarf) {
1128
+ ForEachSymbolFile (" Looking up functions" , [&](SymbolFileDWARF & oso_dwarf) {
1129
1129
uint32_t sc_idx = sc_list.GetSize ();
1130
1130
1131
- oso_dwarf-> FindFunctions (regex, include_inlines, sc_list);
1131
+ oso_dwarf. FindFunctions (regex, include_inlines, sc_list);
1132
1132
if (!sc_list.IsEmpty ()) {
1133
1133
RemoveFunctionsWithModuleNotEqualTo (m_objfile_sp->GetModule (), sc_list,
1134
1134
sc_idx);
@@ -1156,8 +1156,8 @@ void SymbolFileDWARFDebugMap::GetTypes(SymbolContextScope *sc_scope,
1156
1156
oso_dwarf->GetTypes (sc_scope, type_mask, type_list);
1157
1157
}
1158
1158
} else {
1159
- ForEachSymbolFile (" Looking up types" , [&](SymbolFileDWARF * oso_dwarf) {
1160
- oso_dwarf-> GetTypes (sc_scope, type_mask, type_list);
1159
+ ForEachSymbolFile (" Looking up types" , [&](SymbolFileDWARF & oso_dwarf) {
1160
+ oso_dwarf. GetTypes (sc_scope, type_mask, type_list);
1161
1161
return IterationAction::Continue;
1162
1162
});
1163
1163
}
@@ -1176,8 +1176,8 @@ SymbolFileDWARFDebugMap::ParseCallEdgesInFunction(
1176
1176
DWARFDIE SymbolFileDWARFDebugMap::FindDefinitionDIE (const DWARFDIE &die) {
1177
1177
DWARFDIE result;
1178
1178
ForEachSymbolFile (
1179
- " Looking up type definition" , [&](SymbolFileDWARF * oso_dwarf) {
1180
- result = oso_dwarf-> FindDefinitionDIE (die);
1179
+ " Looking up type definition" , [&](SymbolFileDWARF & oso_dwarf) {
1180
+ result = oso_dwarf. FindDefinitionDIE (die);
1181
1181
return result ? IterationAction::Stop : IterationAction::Continue;
1182
1182
});
1183
1183
return result;
@@ -1236,8 +1236,8 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(
1236
1236
TypeSP type_sp;
1237
1237
1238
1238
ForEachSymbolFile (
1239
- " Looking up Objective-C definition" , [&](SymbolFileDWARF * oso_dwarf) {
1240
- type_sp = oso_dwarf-> FindCompleteObjCDefinitionTypeForDIE (
1239
+ " Looking up Objective-C definition" , [&](SymbolFileDWARF & oso_dwarf) {
1240
+ type_sp = oso_dwarf. FindCompleteObjCDefinitionTypeForDIE (
1241
1241
die, type_name, must_be_implementation);
1242
1242
return type_sp ? IterationAction::Stop : IterationAction::Continue;
1243
1243
});
@@ -1250,8 +1250,8 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(
1250
1250
void SymbolFileDWARFDebugMap::FindTypes (const TypeQuery &query,
1251
1251
TypeResults &results) {
1252
1252
std::lock_guard<std::recursive_mutex> guard (GetModuleMutex ());
1253
- ForEachSymbolFile (" Looking up type" , [&](SymbolFileDWARF * oso_dwarf) {
1254
- oso_dwarf-> FindTypes (query, results);
1253
+ ForEachSymbolFile (" Looking up type" , [&](SymbolFileDWARF & oso_dwarf) {
1254
+ oso_dwarf. FindTypes (query, results);
1255
1255
return results.Done (query) ? IterationAction::Stop
1256
1256
: IterationAction::Continue;
1257
1257
});
@@ -1263,9 +1263,9 @@ CompilerDeclContext SymbolFileDWARFDebugMap::FindNamespace(
1263
1263
std::lock_guard<std::recursive_mutex> guard (GetModuleMutex ());
1264
1264
CompilerDeclContext matching_namespace;
1265
1265
1266
- ForEachSymbolFile (" Looking up namespace" , [&](SymbolFileDWARF * oso_dwarf) {
1266
+ ForEachSymbolFile (" Looking up namespace" , [&](SymbolFileDWARF & oso_dwarf) {
1267
1267
matching_namespace =
1268
- oso_dwarf-> FindNamespace (name, parent_decl_ctx, only_root_namespaces);
1268
+ oso_dwarf. FindNamespace (name, parent_decl_ctx, only_root_namespaces);
1269
1269
1270
1270
return matching_namespace ? IterationAction::Stop
1271
1271
: IterationAction::Continue;
@@ -1275,8 +1275,8 @@ CompilerDeclContext SymbolFileDWARFDebugMap::FindNamespace(
1275
1275
}
1276
1276
1277
1277
void SymbolFileDWARFDebugMap::DumpClangAST (Stream &s) {
1278
- ForEachSymbolFile (" Dumping clang AST" , [&s](SymbolFileDWARF * oso_dwarf) {
1279
- oso_dwarf-> DumpClangAST (s);
1278
+ ForEachSymbolFile (" Dumping clang AST" , [&s](SymbolFileDWARF & oso_dwarf) {
1279
+ oso_dwarf. DumpClangAST (s);
1280
1280
// The underlying assumption is that DumpClangAST(...) will obtain the
1281
1281
// AST from the underlying TypeSystem and therefore we only need to do
1282
1282
// this once and can stop after the first iteration hence we return true.
@@ -1412,8 +1412,8 @@ SymbolFileDWARFDebugMap::GetCompilerContextForUID(lldb::user_id_t type_uid) {
1412
1412
1413
1413
void SymbolFileDWARFDebugMap::ParseDeclsForContext (
1414
1414
lldb_private::CompilerDeclContext decl_ctx) {
1415
- ForEachSymbolFile (" Parsing declarations" , [&](SymbolFileDWARF * oso_dwarf) {
1416
- oso_dwarf-> ParseDeclsForContext (decl_ctx);
1415
+ ForEachSymbolFile (" Parsing declarations" , [&](SymbolFileDWARF & oso_dwarf) {
1416
+ oso_dwarf. ParseDeclsForContext (decl_ctx);
1417
1417
return IterationAction::Continue;
1418
1418
});
1419
1419
}
@@ -1542,8 +1542,8 @@ SymbolFileDWARFDebugMap::AddOSOARanges(SymbolFileDWARF *dwarf2Data,
1542
1542
1543
1543
ModuleList SymbolFileDWARFDebugMap::GetDebugInfoModules () {
1544
1544
ModuleList oso_modules;
1545
- ForEachSymbolFile (" Parsing modules" , [&](SymbolFileDWARF * oso_dwarf) {
1546
- ObjectFile *oso_objfile = oso_dwarf-> GetObjectFile ();
1545
+ ForEachSymbolFile (" Parsing modules" , [&](SymbolFileDWARF & oso_dwarf) {
1546
+ ObjectFile *oso_objfile = oso_dwarf. GetObjectFile ();
1547
1547
if (oso_objfile) {
1548
1548
ModuleSP module_sp = oso_objfile->GetModule ();
1549
1549
if (module_sp)
@@ -1603,8 +1603,8 @@ Status SymbolFileDWARFDebugMap::CalculateFrameVariableError(StackFrame &frame) {
1603
1603
void SymbolFileDWARFDebugMap::GetCompileOptions (
1604
1604
std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {
1605
1605
1606
- ForEachSymbolFile (" Parsing compile options" , [&](SymbolFileDWARF * oso_dwarf) {
1607
- oso_dwarf-> GetCompileOptions (args);
1606
+ ForEachSymbolFile (" Parsing compile options" , [&](SymbolFileDWARF & oso_dwarf) {
1607
+ oso_dwarf. GetCompileOptions (args);
1608
1608
return IterationAction::Continue;
1609
1609
});
1610
1610
}
0 commit comments