Skip to content

Commit 8ef932b

Browse files
bdash0cyn
authored andcommitted
[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 4bc3153 commit 8ef932b

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
@@ -955,6 +955,7 @@ void ObjCProcessor::ReadMethodList(ObjCReader* reader, ClassBase& cls, std::stri
955955
DefineObjCSymbol(DataSymbol, Type::PointerType(m_data->GetAddressSize(), selType),
956956
"selRef_" + method.name, meth.name, true);
957957
}
958+
958959
// workflow objc support
959960
if (selAddr)
960961
m_selToImplementations[selAddr].push_back(meth.imp);
@@ -967,6 +968,11 @@ void ObjCProcessor::ReadMethodList(ObjCReader* reader, ClassBase& cls, std::stri
967968
method.imp = meth.imp;
968969
cls.methodList[cursor] = method;
969970
m_localMethods[cursor] = method;
971+
972+
if (selAddr)
973+
m_data->AddUserDataReference(selAddr, meth.imp);
974+
if (selRefAddr)
975+
m_data->AddUserDataReference(selRefAddr, meth.imp);
970976
}
971977
catch (...)
972978
{

0 commit comments

Comments
 (0)