[w32handle] Stop returning 0 in every cases for locking/unlocking (#3926)
[mono.git] / mcs / tools / tuner / Mono.Tuner / RemoveSecurity.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4
5 using Mono.Linker;
6 using Mono.Linker.Steps;
7
8 using Mono.Cecil;
9
10 namespace Mono.Tuner {
11
12         public class RemoveSecurity : BaseSubStep {
13
14                 public override SubStepTargets Targets {
15                         get {
16                                 return SubStepTargets.Assembly
17                                         | SubStepTargets.Type
18                                         | SubStepTargets.Method;
19                         }
20                 }
21
22                 public override bool IsActiveFor (AssemblyDefinition assembly)
23                 {
24                         return Annotations.GetAction (assembly) == AssemblyAction.Link;
25                 }
26
27                 public override void ProcessAssembly (AssemblyDefinition assembly)
28                 {
29                         ProcessSecurityProvider (assembly);
30                 }
31
32                 public override void ProcessType (TypeDefinition type)
33                 {
34                         ProcessSecurityProvider (type);
35                 }
36
37                 public override void ProcessMethod (MethodDefinition method)
38                 {
39                         ProcessSecurityProvider (method);
40                 }
41
42                 static void ProcessSecurityProvider (ISecurityDeclarationProvider provider)
43                 {
44                         if (!provider.HasSecurityDeclarations)
45                                 return;
46
47                         provider.SecurityDeclarations.Clear ();
48                 }
49         }
50 }