Skip to content

Commit 59fbb17

Browse files
Merge pull request #8612 from adrian-prantl/redundant-ast
Remove redundant code (NFC)
2 parents 89cd623 + b9aa15d commit 59fbb17

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
@@ -4367,44 +4367,31 @@ void SwiftASTContext::RegisterSectionModules(
43674367
}
43684368
};
43694369

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

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

0 commit comments

Comments
 (0)