diff options
| author | WeiN76LQh <WeiN76LQh@github.com> | 2025-01-03 17:55:10 +0000 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-04-02 05:36:54 -0400 |
| commit | ee500220baa1a46f3d7ca1486fa43dc1587f20d0 (patch) | |
| tree | ee3e1549997e60849f040f5745cdac8840f25303 /view/macho/machoview.cpp | |
| parent | 90e9ff91f02f2cb902bf0564de1f403e23172f36 (diff) | |
[ObjC] Create a shared ObjC processor for Macho and DSC views
Both the Macho and DSC views need to process Objective-C but have separate processor classes. It would appear that the DSC version was largely a copy and paste of the Macho view one, with some modifications. The majority of code overlaps between the 2 so it doesn't make sense to maintain 2 and copy and paste improvements/fixes between them.
This commit fixes that by creating a base Objective-C processor that contains the shared code. View specific code is implemented in the respective subclasses for the views. Although there is very little view specific code for each.
Diffstat (limited to 'view/macho/machoview.cpp')
| -rw-r--r-- | view/macho/machoview.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/view/macho/machoview.cpp b/view/macho/machoview.cpp index 2a927671..8a320545 100644 --- a/view/macho/machoview.cpp +++ b/view/macho/machoview.cpp @@ -1840,13 +1840,13 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_ parseObjCStructs = settings->Get<bool>("loader.macho.processObjectiveC", this); if (settings && settings->Contains("loader.macho.processCFStrings")) parseCFStrings = settings->Get<bool>("loader.macho.processCFStrings", this); - if (!ObjCProcessor::ViewHasObjCMetadata(this)) + if (!MachoObjCProcessor::ViewHasObjCMetadata(this)) parseObjCStructs = false; if (!GetSectionByName("__cfstring")) parseCFStrings = false; if (parseObjCStructs || parseCFStrings) { - m_objcProcessor = new ObjCProcessor(this, m_backedByDatabase); + m_objcProcessor = new MachoObjCProcessor(this, m_backedByDatabase); } if (parseObjCStructs) { @@ -2332,7 +2332,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_ if (parseCFStrings) { try { - m_objcProcessor->ProcessCFStrings(); + m_objcProcessor->ProcessCFStrings(std::nullopt); } catch (std::exception& ex) { @@ -2344,7 +2344,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_ if (parseObjCStructs) { try { - m_objcProcessor->ProcessObjCData(); + m_objcProcessor->ProcessObjCData(std::nullopt); } catch (std::exception& ex) { @@ -3872,7 +3872,7 @@ Ref<Settings> MachoViewType::GetLoadSettingsForData(BinaryView* data) settings->UpdateProperty(override, "readOnly", false); } - if (ObjCProcessor::ViewHasObjCMetadata(viewRef)) + if (MachoObjCProcessor::ViewHasObjCMetadata(viewRef)) { settings->RegisterSetting("loader.macho.processObjectiveC", R"({ |
