Skip to content

Commit d9b2438

Browse files
committed
Remove redundant code (NFC)
Module::GetASTDatas() already handles both debug map and dsym cases, and the removed code replicates what that function does directly. (cherry picked from commit b9aa15d)
1 parent 27d0673 commit d9b2438

File tree

1 file changed

+24
-37
lines changed

1 file changed

+24
-37
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4365,44 +4365,31 @@ void SwiftASTContext::RegisterSectionModules(
43654365
}
43664366
};
43674367

4368-
if (auto section_sp =
4369-
section_list->FindSectionByType(eSectionTypeSwiftModules, true)) {
4370-
DataExtractor section_data;
4371-
4372-
if (section_sp->GetSectionData(section_data)) {
4373-
llvm::StringRef section_data_ref(
4374-
(const char *)section_data.GetDataStart(),
4375-
section_data.GetByteSize());
4376-
parse_ast_section(section_data_ref, 1, 1);
4377-
}
4378-
} else {
4379-
if (m_ast_file_data_map.find(&module) != m_ast_file_data_map.end())
4380-
return;
4368+
if (m_ast_file_data_map.find(&module) != m_ast_file_data_map.end())
4369+
return;
43814370

4382-
// Grab all the AST blobs from the symbol vendor.
4383-
auto ast_file_datas = module.GetASTData(eLanguageTypeSwift);
4384-
LOG_PRINTF(GetLog(LLDBLog::Types),
4385-
"(\"%s\") retrieved %zu AST Data blobs from the symbol vendor "
4386-
"(filter=\"%s\").",
4387-
GetBriefModuleName(module).c_str(), ast_file_datas.size(),
4388-
filter.str().c_str());
4389-
4390-
// Add each of the AST blobs to the vector of AST blobs for
4391-
// the module.
4392-
auto &ast_vector = GetASTVectorForModule(&module);
4393-
ast_vector.insert(ast_vector.end(), ast_file_datas.begin(),
4394-
ast_file_datas.end());
4395-
4396-
// Retrieve the module names from the AST blobs retrieved
4397-
// from the symbol vendor.
4398-
size_t i = 0;
4399-
for (auto ast_file_data_sp : ast_file_datas) {
4400-
// Parse the AST section info from the AST blob.
4401-
llvm::StringRef section_data_ref(
4402-
(const char *)ast_file_data_sp->GetBytes(),
4403-
ast_file_data_sp->GetByteSize());
4404-
parse_ast_section(section_data_ref, ++i, ast_file_datas.size());
4405-
}
4371+
// Grab all the AST blobs from the symbol vendor.
4372+
auto ast_file_datas = module.GetASTData(eLanguageTypeSwift);
4373+
LOG_PRINTF(GetLog(LLDBLog::Types),
4374+
"(\"%s\") retrieved %zu AST Data blobs from the symbol vendor "
4375+
"(filter=\"%s\").",
4376+
GetBriefModuleName(module).c_str(), ast_file_datas.size(),
4377+
filter.str().c_str());
4378+
4379+
// Add each of the AST blobs to the vector of AST blobs for
4380+
// the module.
4381+
auto &ast_vector = GetASTVectorForModule(&module);
4382+
ast_vector.insert(ast_vector.end(), ast_file_datas.begin(),
4383+
ast_file_datas.end());
4384+
4385+
// Retrieve the module names from the AST blobs retrieved
4386+
// from the symbol vendor.
4387+
size_t i = 0;
4388+
for (auto ast_file_data_sp : ast_file_datas) {
4389+
// Parse the AST section info from the AST blob.
4390+
llvm::StringRef section_data_ref((const char *)ast_file_data_sp->GetBytes(),
4391+
ast_file_data_sp->GetByteSize());
4392+
parse_ast_section(section_data_ref, ++i, ast_file_datas.size());
44064393
}
44074394
}
44084395

0 commit comments

Comments
 (0)