You've already forked linux-packaging-mono
Imported Upstream version 5.12.0.220
Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
parent
8bd104cef2
commit
8fc30896db
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Mono.Linker;
|
||||
using Mono.Linker.Steps;
|
||||
@ -8,17 +9,41 @@ namespace ILLink.CustomSteps
|
||||
{
|
||||
public class ClearInitLocalsStep : BaseStep
|
||||
{
|
||||
protected override void ProcessAssembly(AssemblyDefinition assembly)
|
||||
HashSet<string> _assemblies;
|
||||
|
||||
protected override void Process ()
|
||||
{
|
||||
string parameterName = "ClearInitLocalsAssemblies";
|
||||
|
||||
if (Context.HasParameter (parameterName)) {
|
||||
string parameter = Context.GetParameter (parameterName);
|
||||
_assemblies = new HashSet<string> (parameter.Split(','), StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ProcessAssembly (AssemblyDefinition assembly)
|
||||
{
|
||||
if ((_assemblies != null) && (!_assemblies.Contains (assembly.Name.Name))) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool changed = false;
|
||||
|
||||
foreach (ModuleDefinition module in assembly.Modules) {
|
||||
foreach (TypeDefinition type in module.Types) {
|
||||
foreach (MethodDefinition method in type.Methods) {
|
||||
if (method.Body != null) {
|
||||
method.Body.InitLocals = false;
|
||||
if (method.Body.InitLocals) {
|
||||
method.Body.InitLocals = false;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (changed && (Annotations.GetAction (assembly) == AssemblyAction.Copy))
|
||||
Annotations.SetAction (assembly, AssemblyAction.Save);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user