Skip to content

[lldb] Update CanContainSwiftReflectionData for Mach-O #3905

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
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
13 changes: 2 additions & 11 deletions lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7022,17 +7022,8 @@ llvm::StringRef ObjectFileMachO::GetReflectionSectionIdentifier(
#ifdef LLDB_ENABLE_SWIFT
bool ObjectFileMachO::CanContainSwiftReflectionData(const Section &section) {
swift::SwiftObjectFileFormatMachO file_format;
if (file_format.sectionContainsReflectionData(
section.GetName().GetStringRef()))
return true;
// Some section names are not unique, such as `__const`, which could be in
// `__TEXT` or `__DATA`. For these, also check the segment,section name.
if (auto segment = section.GetParent()) {
std::string segmentSectionName =
llvm::formatv("{0},{1}", segment->GetName(), section.GetName()).str();
return file_format.sectionContainsReflectionData(segmentSectionName);
}
return false;
return file_format.sectionContainsReflectionData(
section.GetName().GetStringRef());
}
#endif // LLDB_ENABLE_SWIFT

Expand Down