@@ -1791,15 +1791,16 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(lldb::LanguageType language,
1791
1791
1792
1792
std::vector<std::string> module_names;
1793
1793
swift_ast_sp->RegisterSectionModules (module , module_names);
1794
- swift_ast_sp->ValidateSectionModules (module , module_names);
1795
-
1796
- if (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES)) {
1797
- std::lock_guard<std::recursive_mutex> locker (g_log_mutex);
1798
- LOG_PRINTF (LIBLLDB_LOG_TYPES, " ((Module*)%p, \" %s\" ) = %p" ,
1799
- static_cast <void *>(&module ),
1800
- module .GetFileSpec ().GetFilename ().AsCString (" <anonymous>" ),
1801
- static_cast <void *>(swift_ast_sp.get ()));
1802
- swift_ast_sp->LogConfiguration ();
1794
+ if (module_names.size ()) {
1795
+ swift_ast_sp->ValidateSectionModules (module , module_names);
1796
+ if (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES)) {
1797
+ std::lock_guard<std::recursive_mutex> locker (g_log_mutex);
1798
+ LOG_PRINTF (LIBLLDB_LOG_TYPES, " ((Module*)%p, \" %s\" ) = %p" ,
1799
+ static_cast <void *>(&module ),
1800
+ module .GetFileSpec ().GetFilename ().AsCString (" <anonymous>" ),
1801
+ static_cast <void *>(swift_ast_sp.get ()));
1802
+ swift_ast_sp->LogConfiguration ();
1803
+ }
1803
1804
}
1804
1805
return swift_ast_sp;
1805
1806
}
@@ -4224,18 +4225,18 @@ static std::string GetBriefModuleName(Module &module) {
4224
4225
return ss.GetString ().str ();
4225
4226
}
4226
4227
4227
- bool SwiftASTContext::RegisterSectionModules (
4228
+ void SwiftASTContext::RegisterSectionModules (
4228
4229
Module &module , std::vector<std::string> &module_names) {
4229
- VALID_OR_RETURN ( false );
4230
+ VALID_OR_RETURN_VOID ( );
4230
4231
4231
4232
swift::MemoryBufferSerializedModuleLoader *loader =
4232
4233
GetMemoryBufferModuleLoader ();
4233
4234
if (!loader)
4234
- return false ;
4235
+ return ;
4235
4236
4236
4237
SectionList *section_list = module .GetSectionList ();
4237
4238
if (!section_list)
4238
- return false ;
4239
+ return ;
4239
4240
4240
4241
SectionSP section_sp (
4241
4242
section_list->FindSectionByType (eSectionTypeSwiftModules, true ));
@@ -4250,12 +4251,12 @@ bool SwiftASTContext::RegisterSectionModules(
4250
4251
if (swift::parseASTSection (*loader, section_data_ref, llvm_modules)) {
4251
4252
for (auto module_name : llvm_modules)
4252
4253
module_names.push_back (module_name);
4253
- return true ;
4254
+ return ;
4254
4255
}
4255
4256
}
4256
4257
} else {
4257
4258
if (m_ast_file_data_map.find (&module ) != m_ast_file_data_map.end ())
4258
- return true ;
4259
+ return ;
4259
4260
4260
4261
// Grab all the AST blobs from the symbol vendor.
4261
4262
auto ast_file_datas = module .GetASTData (eLanguageTypeSwift);
@@ -4301,10 +4302,10 @@ bool SwiftASTContext::RegisterSectionModules(
4301
4302
}
4302
4303
if (!ast_file_datas.empty () && (parse_fail_count == 0 )) {
4303
4304
// We found AST data entries and we successfully parsed all of them.
4304
- return true ;
4305
+ return ;
4305
4306
}
4306
4307
}
4307
- return false ;
4308
+ return ;
4308
4309
}
4309
4310
4310
4311
void SwiftASTContext::ValidateSectionModules (
0 commit comments