Skip to content

Commit 4a042a0

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 b93fab7 commit 4a042a0

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
@@ -892,6 +892,7 @@ void ObjCProcessor::ReadMethodList(ObjCReader* reader, ClassBase& cls, std::stri
892892
DefineObjCSymbol(DataSymbol, Type::PointerType(m_data->GetAddressSize(), selType),
893893
"selRef_" + method.name, meth.name, true);
894894
}
895+
895896
// workflow objc support
896897
if (selAddr)
897898
m_selToImplementations[selAddr].push_back(meth.imp);
@@ -904,6 +905,11 @@ void ObjCProcessor::ReadMethodList(ObjCReader* reader, ClassBase& cls, std::stri
904905
method.imp = meth.imp;
905906
cls.methodList[cursor] = method;
906907
m_localMethods[cursor] = method;
908+
909+
if (selAddr)
910+
m_data->AddUserDataReference(selAddr, meth.imp);
911+
if (selRefAddr)
912+
m_data->AddUserDataReference(selRefAddr, meth.imp);
907913
}
908914
catch (...)
909915
{

0 commit comments

Comments
 (0)