[linker] Only look for BindAs attributes in assemblies that reference the BindAsAttribute type.

This commit is contained in:
Rolf Bjarne Kvinge 2017-07-11 09:57:18 +02:00
Родитель 9859e04ee2
Коммит 99cc47e99b
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -27,9 +27,16 @@ namespace Xamarin.Linker.Steps
public override bool IsActiveFor (AssemblyDefinition assembly)
{
// we need to process all assemblies, because the functions we want to
// preserve are not necessarily in the assembly we're processing.
if (Profile.IsProductAssembly (assembly))
return true;
// We don't need to process assemblies that don't reference ObjCRuntime.BindAsAttribute.
foreach (var tr in assembly.MainModule.GetTypeReferences ()) {
if (tr.IsPlatformType ("ObjCRuntime", "BindAsAttribute"))
return true;
}
return false;
}
void Preserve (Tuple<MethodDefinition, MethodDefinition> pair, MethodDefinition conditionA, MethodDefinition conditionB = null)