Skip to content

Commit 9423efd

Browse files
committed
[ObjC] Add an explicit reference to a method impl from its selector
This makes it easier to see the possible message send targets when looking at a call to `objc_msgSend`.
1 parent f9ac749 commit 9423efd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

objectivec/objc.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ void ObjCProcessor::ReadMethodList(ObjCReader* reader, ClassBase& cls, std::stri
893893
DefineObjCSymbol(DataSymbol, Type::PointerType(m_data->GetAddressSize(), selType),
894894
"selRef_" + method.name, meth.name, true);
895895
}
896+
896897
// workflow objc support
897898
if (selAddr)
898899
m_selToImplementations[selAddr].push_back(meth.imp);
@@ -905,6 +906,11 @@ void ObjCProcessor::ReadMethodList(ObjCReader* reader, ClassBase& cls, std::stri
905906
method.imp = meth.imp;
906907
cls.methodList[cursor] = method;
907908
m_localMethods[cursor] = method;
909+
910+
if (selAddr)
911+
m_data->AddUserDataReference(selAddr, meth.imp);
912+
if (selRefAddr)
913+
m_data->AddUserDataReference(selRefAddr, meth.imp);
908914
}
909915
catch (...)
910916
{

0 commit comments

Comments
 (0)