Skip to content

Remove redundant code (NFC) #8612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 24 additions & 37 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4367,44 +4367,31 @@ void SwiftASTContext::RegisterSectionModules(
}
};

if (auto section_sp =
section_list->FindSectionByType(eSectionTypeSwiftModules, true)) {
DataExtractor section_data;

if (section_sp->GetSectionData(section_data)) {
llvm::StringRef section_data_ref(
(const char *)section_data.GetDataStart(),
section_data.GetByteSize());
parse_ast_section(section_data_ref, 1, 1);
}
} else {
if (m_ast_file_data_map.find(&module) != m_ast_file_data_map.end())
return;
if (m_ast_file_data_map.find(&module) != m_ast_file_data_map.end())
return;

// Grab all the AST blobs from the symbol vendor.
auto ast_file_datas = module.GetASTData(eLanguageTypeSwift);
LOG_PRINTF(GetLog(LLDBLog::Types),
"(\"%s\") retrieved %zu AST Data blobs from the symbol vendor "
"(filter=\"%s\").",
GetBriefModuleName(module).c_str(), ast_file_datas.size(),
filter.str().c_str());

// Add each of the AST blobs to the vector of AST blobs for
// the module.
auto &ast_vector = GetASTVectorForModule(&module);
ast_vector.insert(ast_vector.end(), ast_file_datas.begin(),
ast_file_datas.end());

// Retrieve the module names from the AST blobs retrieved
// from the symbol vendor.
size_t i = 0;
for (auto ast_file_data_sp : ast_file_datas) {
// Parse the AST section info from the AST blob.
llvm::StringRef section_data_ref(
(const char *)ast_file_data_sp->GetBytes(),
ast_file_data_sp->GetByteSize());
parse_ast_section(section_data_ref, ++i, ast_file_datas.size());
}
// Grab all the AST blobs from the symbol vendor.
auto ast_file_datas = module.GetASTData(eLanguageTypeSwift);
LOG_PRINTF(GetLog(LLDBLog::Types),
"(\"%s\") retrieved %zu AST Data blobs from the symbol vendor "
"(filter=\"%s\").",
GetBriefModuleName(module).c_str(), ast_file_datas.size(),
filter.str().c_str());

// Add each of the AST blobs to the vector of AST blobs for
// the module.
auto &ast_vector = GetASTVectorForModule(&module);
ast_vector.insert(ast_vector.end(), ast_file_datas.begin(),
ast_file_datas.end());

// Retrieve the module names from the AST blobs retrieved
// from the symbol vendor.
size_t i = 0;
for (auto ast_file_data_sp : ast_file_datas) {
// Parse the AST section info from the AST blob.
llvm::StringRef section_data_ref((const char *)ast_file_data_sp->GetBytes(),
ast_file_data_sp->GetByteSize());
parse_ast_section(section_data_ref, ++i, ast_file_datas.size());
}
}

Expand Down