diff options
author | Jackson Schuster <jschuster@microsoft.com> | 2021-12-10 18:27:35 +0300 |
---|---|---|
committer | Jackson Schuster <jschuster@microsoft.com> | 2021-12-10 20:03:11 +0300 |
commit | 359a51bd6ab157d6890aa18fb2fa76e7a2ac0a05 (patch) | |
tree | c6ece3a6c85a191842307f6ff96187d18aa8f463 /src | |
parent | fd8aa603ec738bbf953167543430bc017986530a (diff) |
Restore unnecessary changes and format
Remove .gitignore changes
Fix formatting with dotnet-format
Diffstat (limited to 'src')
23 files changed, 62 insertions, 82 deletions
diff --git a/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs b/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs index 312e9bcdc..b9032ee22 100644 --- a/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs +++ b/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs @@ -220,7 +220,7 @@ namespace ILLink.RoslynAnalyzer ISymbol containingSymbol = FindContainingSymbol (operationContext, AnalyzerDiagnosticTargets); // Do not emit any diagnostic if caller is annotated with the attribute too. - if (containingSymbol.IsInRequiresScope(RequiresAttributeName)) + if (containingSymbol.IsInRequiresScope (RequiresAttributeName)) return; if (ReportSpecialIncompatibleMembersDiagnostic (operationContext, incompatibleMembers, member)) diff --git a/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs b/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs index f4ae7a3e7..24f8a0623 100644 --- a/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs +++ b/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs @@ -1,13 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Text; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; namespace ILLink.RoslynAnalyzer { @@ -29,12 +23,12 @@ namespace ILLink.RoslynAnalyzer /// <param name="containingSymbol"> /// Symbol that is either an overriding member or an overriden/virtual member /// </param> - public static bool IsOverrideInRequiresScope(this ISymbol member, string requiresAttribute) + public static bool IsOverrideInRequiresScope (this ISymbol member, string requiresAttribute) { - return member.IsInRequiresScope(requiresAttribute, false); + return member.IsInRequiresScope (requiresAttribute, false); } - private static bool IsInRequiresScope (this ISymbol member, string requiresAttribute, bool checkAssociatedSymbol) + private static bool IsInRequiresScope (this ISymbol member, string requiresAttribute, bool checkAssociatedSymbol) { if (member is ISymbol containingSymbol) { if (containingSymbol.HasAttribute (requiresAttribute) diff --git a/src/ILLink.Shared/DiagnosticString.cs b/src/ILLink.Shared/DiagnosticString.cs index e01cc9b5b..3464ef0a2 100644 --- a/src/ILLink.Shared/DiagnosticString.cs +++ b/src/ILLink.Shared/DiagnosticString.cs @@ -1,6 +1,4 @@ -using System; - -namespace ILLink.Shared +namespace ILLink.Shared { public readonly struct DiagnosticString { diff --git a/src/analyzer/ConsoleDependencyGraph.cs b/src/analyzer/ConsoleDependencyGraph.cs index fb2e845ee..50a688208 100644 --- a/src/analyzer/ConsoleDependencyGraph.cs +++ b/src/analyzer/ConsoleDependencyGraph.cs @@ -96,7 +96,7 @@ namespace LinkerAnalyzer int pi = 0, childIdx; do { - childIdx = childVertex.parentIndexes [pi]; + childIdx = childVertex.parentIndexes[pi]; pi++; } while (visited.Contains (childIdx) && pi < childVertex.parentIndexes.Count); @@ -148,13 +148,13 @@ namespace LinkerAnalyzer Header ("Statistics"); if (verbose) { foreach (var key in counts.Keys) - Console.WriteLine ("Vertex type:\t{0}{1}count:{2}", key, Tabs (key), counts [key]); + Console.WriteLine ("Vertex type:\t{0}{1}count:{2}", key, Tabs (key), counts[key]); } else { - Console.WriteLine ("Assemblies:\t{0}", counts ["Assembly"]); - Console.WriteLine ("Modules:\t{0}", counts ["Module"]); - Console.WriteLine ("Types:\t\t{0}", counts ["TypeDef"]); - Console.WriteLine ("Fields:\t\t{0}", counts ["Field"]); - Console.WriteLine ("Methods:\t{0}", counts ["Method"]); + Console.WriteLine ("Assemblies:\t{0}", counts["Assembly"]); + Console.WriteLine ("Modules:\t{0}", counts["Module"]); + Console.WriteLine ("Types:\t\t{0}", counts["TypeDef"]); + Console.WriteLine ("Fields:\t\t{0}", counts["Field"]); + Console.WriteLine ("Methods:\t{0}", counts["Method"]); } Console.WriteLine (); diff --git a/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs b/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs index 183c969da..e4346928b 100644 --- a/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs +++ b/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs @@ -14,7 +14,8 @@ using System.Xml; namespace LinkerAnalyzer.Core { - public class VertexData { + public class VertexData + { public string value; public List<int> parentIndexes; public int index; @@ -51,7 +52,8 @@ namespace LinkerAnalyzer.Core } } - void Load (GZipStream zipStream) { + void Load (GZipStream zipStream) + { using (XmlReader reader = XmlReader.Create (zipStream)) { while (reader.Read ()) { switch (reader.NodeType) { @@ -88,7 +90,7 @@ namespace LinkerAnalyzer.Core VertexData vertex; try { - vertex = vertices [indexes [vertexName]]; + vertex = vertices[indexes[vertexName]]; } catch (KeyNotFoundException) { if (create) { int index = vertices.Count; @@ -97,9 +99,9 @@ namespace LinkerAnalyzer.Core indexes.Add (vertexName, index); string prefix = vertexName.Substring (0, vertexName.IndexOf (':')); if (counts.ContainsKey (prefix)) - counts [prefix]++; + counts[prefix]++; else - counts [prefix] = 1; + counts[prefix] = 1; //Console.WriteLine ("prefix " + prefix + " count " + counts[prefix]); if (prefix == "TypeDef") { Types.Add (vertex); @@ -113,7 +115,7 @@ namespace LinkerAnalyzer.Core public VertexData Vertex (int index) { - return vertices [index]; + return vertices[index]; } IEnumerable<Tuple<VertexData, int>> AddDependencies (VertexData vertex, HashSet<int> reachedVertices, int depth) diff --git a/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs b/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs index 91ee74842..74b4ab928 100644 --- a/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs +++ b/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs @@ -75,7 +75,7 @@ namespace LinkerAnalyzer.Core var key = GetKey (method); if (sizes.ContainsKey (key)) - return sizes [key]; + return sizes[key]; var msize = method.Body.CodeSize; msize += method.Name.Length; @@ -125,7 +125,7 @@ namespace LinkerAnalyzer.Core else Console.Write ("."); - ReaderParameters parameters = new ReaderParameters () { ReadingMode = ReadingMode.Immediate, AssemblyResolver = resolver}; + ReaderParameters parameters = new ReaderParameters () { ReadingMode = ReadingMode.Immediate, AssemblyResolver = resolver }; var assembly = AssemblyDefinition.ReadAssembly (file, parameters); assemblies.Add (assembly); foreach (var module in assembly.Modules) { @@ -146,7 +146,7 @@ namespace LinkerAnalyzer.Core public int GetSize (VertexData vertex) { if (sizes.ContainsKey (vertex.value)) - return sizes [vertex.value]; + return sizes[vertex.value]; return 0; } } diff --git a/src/analyzer/Main.cs b/src/analyzer/Main.cs index 9e9b31cac..2f70441bc 100644 --- a/src/analyzer/Main.cs +++ b/src/analyzer/Main.cs @@ -7,8 +7,8 @@ // Copyright 2015 Xamarin Inc (http://www.xamarin.com). // using System; -using Mono.Options; using LinkerAnalyzer.Core; +using Mono.Options; namespace LinkerAnalyzer { @@ -56,7 +56,7 @@ namespace LinkerAnalyzer return; } - string dependencyFile = args [args.Length - 1]; + string dependencyFile = args[args.Length - 1]; ConsoleDependencyGraph deps = new ConsoleDependencyGraph () { Tree = reduceToTree, FlatDeps = flatDeps }; deps.Load (dependencyFile); diff --git a/src/linker/Linker.Steps/BaseSubStep.cs b/src/linker/Linker.Steps/BaseSubStep.cs index 4826c7014..af991fda9 100644 --- a/src/linker/Linker.Steps/BaseSubStep.cs +++ b/src/linker/Linker.Steps/BaseSubStep.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; using Mono.Cecil; diff --git a/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs b/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs index 8497a61ea..64561aa6b 100644 --- a/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs +++ b/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Diagnostics; using Mono.Cecil; diff --git a/src/linker/Linker.Steps/DiscoverSerializationHandler.cs b/src/linker/Linker.Steps/DiscoverSerializationHandler.cs index 0b30d6ea4..6ac6da881 100644 --- a/src/linker/Linker.Steps/DiscoverSerializationHandler.cs +++ b/src/linker/Linker.Steps/DiscoverSerializationHandler.cs @@ -2,12 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using Mono.Cecil; -using Mono.Linker.Dataflow; -using Mono.Linker.Steps; namespace Mono.Linker.Steps { diff --git a/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs b/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs index f97004fd0..8f15014f3 100644 --- a/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs +++ b/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/linker/Linker.Steps/OutputStep.cs b/src/linker/Linker.Steps/OutputStep.cs index b28d52c8d..2fd32880d 100644 --- a/src/linker/Linker.Steps/OutputStep.cs +++ b/src/linker/Linker.Steps/OutputStep.cs @@ -32,7 +32,6 @@ using System.IO; using System.Linq; using System.Runtime.Serialization.Json; using Mono.Cecil; -using Mono.Cecil.Cil; namespace Mono.Linker.Steps { diff --git a/src/linker/Linker.Steps/SubStepsDispatcher.cs b/src/linker/Linker.Steps/SubStepsDispatcher.cs index 3ed5a6e1c..338bbda8b 100644 --- a/src/linker/Linker.Steps/SubStepsDispatcher.cs +++ b/src/linker/Linker.Steps/SubStepsDispatcher.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/linker/Linker/AttributeInfo.cs b/src/linker/Linker/AttributeInfo.cs index 23b31c433..ea430b2de 100644 --- a/src/linker/Linker/AttributeInfo.cs +++ b/src/linker/Linker/AttributeInfo.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Mono.Cecil; namespace Mono.Linker diff --git a/src/linker/Linker/EmbeddedXmlInfo.cs b/src/linker/Linker/EmbeddedXmlInfo.cs index 14871394b..815bbb8d2 100644 --- a/src/linker/Linker/EmbeddedXmlInfo.cs +++ b/src/linker/Linker/EmbeddedXmlInfo.cs @@ -2,10 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.IO; using System.Linq; using System.Xml; -using System.Xml.XPath; using Mono.Cecil; using Mono.Linker.Steps; diff --git a/src/linker/Linker/MemberReferenceExtensions.cs b/src/linker/Linker/MemberReferenceExtensions.cs index b24364aaa..14278fdef 100644 --- a/src/linker/Linker/MemberReferenceExtensions.cs +++ b/src/linker/Linker/MemberReferenceExtensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics; +using System.Diagnostics; using System.Text; using Mono.Cecil; diff --git a/src/linker/Linker/MethodDefinitionExtensions.cs b/src/linker/Linker/MethodDefinitionExtensions.cs index 165b75138..d8b370422 100644 --- a/src/linker/Linker/MethodDefinitionExtensions.cs +++ b/src/linker/Linker/MethodDefinitionExtensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using Mono.Cecil; namespace Mono.Linker diff --git a/src/linker/ref/Linker.Steps/BaseStep.cs b/src/linker/ref/Linker.Steps/BaseStep.cs index 53d03bbdd..417d0bf75 100644 --- a/src/linker/ref/Linker.Steps/BaseStep.cs +++ b/src/linker/ref/Linker.Steps/BaseStep.cs @@ -8,8 +8,8 @@ namespace Mono.Linker.Steps public abstract class BaseStep : IStep { - public LinkContext Context { get { throw null; } } - public AnnotationStore Annotations { get { throw null; } } + public static LinkContext Context { get { throw null; } } + public static AnnotationStore Annotations { get { throw null; } } public void Process (LinkContext context) { throw null; } protected virtual bool ConditionToProcess () { throw null; } protected virtual void Process () { throw null; } diff --git a/src/linker/ref/Linker.Steps/BaseSubStep.cs b/src/linker/ref/Linker.Steps/BaseSubStep.cs index 6fa045a1c..9f4f72067 100644 --- a/src/linker/ref/Linker.Steps/BaseSubStep.cs +++ b/src/linker/ref/Linker.Steps/BaseSubStep.cs @@ -7,9 +7,9 @@ namespace Mono.Linker.Steps { public abstract class BaseSubStep : ISubStep { - protected AnnotationStore Annotations { get => throw null; } + protected static AnnotationStore Annotations { get => throw null; } - protected LinkContext Context { get => throw null; } + protected static LinkContext Context { get => throw null; } public abstract SubStepTargets Targets { get; } diff --git a/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs b/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs index f6bbbbddd..bf6f7c64a 100644 --- a/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs +++ b/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs @@ -11,7 +11,7 @@ namespace Mono.Linker.Steps protected SubStepsDispatcher (IEnumerable<ISubStep> subSteps) => throw null; - public void Add (ISubStep substep) => throw null; + public static void Add (ISubStep substep) => throw null; void IStep.Process (LinkContext context) => throw null; } diff --git a/src/linker/ref/Linker/Annotations.cs b/src/linker/ref/Linker/Annotations.cs index 4490ffbf4..69309cb73 100644 --- a/src/linker/ref/Linker/Annotations.cs +++ b/src/linker/ref/Linker/Annotations.cs @@ -11,26 +11,26 @@ namespace Mono.Linker { internal AnnotationStore () { } - public IEnumerable<OverrideInformation> GetOverrides (MethodDefinition method) { throw null; } + public static IEnumerable<OverrideInformation> GetOverrides (MethodDefinition method) { throw null; } - public void Mark (IMetadataTokenProvider provider) { throw null; } - public void Mark (CustomAttribute attribute) { throw null; } + public static void Mark (IMetadataTokenProvider provider) { throw null; } + public static void Mark (CustomAttribute attribute) { throw null; } - public bool IsMarked (IMetadataTokenProvider provider) { throw null; } - public bool IsMarked (CustomAttribute attribute) { throw null; } + public static bool IsMarked (IMetadataTokenProvider provider) { throw null; } + public static bool IsMarked (CustomAttribute attribute) { throw null; } - public void AddPreservedMethod (MethodDefinition key, MethodDefinition method) { throw null; } - public void AddPreservedMethod (TypeDefinition type, MethodDefinition method) { throw null; } - public void SetPreserve (TypeDefinition type, TypePreserve preserve) { throw null; } + public static void AddPreservedMethod (MethodDefinition key, MethodDefinition method) { throw null; } + public static void AddPreservedMethod (TypeDefinition type, MethodDefinition method) { throw null; } + public static void SetPreserve (TypeDefinition type, TypePreserve preserve) { throw null; } - public void SetAction (MethodDefinition method, MethodAction action) { throw null; } - public void SetStubValue (MethodDefinition method, object value) { throw null; } + public static void SetAction (MethodDefinition method, MethodAction action) { throw null; } + public static void SetStubValue (MethodDefinition method, object value) { throw null; } - public AssemblyAction GetAction (AssemblyDefinition assembly) { throw null; } - public void SetAction (AssemblyDefinition assembly, AssemblyAction action) { throw null; } - public bool HasAction (AssemblyDefinition assembly) { throw null; } + public static AssemblyAction GetAction (AssemblyDefinition assembly) { throw null; } + public static void SetAction (AssemblyDefinition assembly, AssemblyAction action) { throw null; } + public static bool HasAction (AssemblyDefinition assembly) { throw null; } - public object GetCustomAnnotation (object key, IMetadataTokenProvider item) { throw null; } - public void SetCustomAnnotation (object key, IMetadataTokenProvider item, object value) { throw null; } + public static object GetCustomAnnotation (object key, IMetadataTokenProvider item) { throw null; } + public static void SetCustomAnnotation (object key, IMetadataTokenProvider item, object value) { throw null; } } } diff --git a/src/linker/ref/Linker/LinkContext.cs b/src/linker/ref/Linker/LinkContext.cs index 08dc1297e..3a452fd4c 100644 --- a/src/linker/ref/Linker/LinkContext.cs +++ b/src/linker/ref/Linker/LinkContext.cs @@ -9,25 +9,25 @@ namespace Mono.Linker public class LinkContext : IMetadataResolver { internal LinkContext () { } - public AnnotationStore Annotations { get { throw null; } } + public static AnnotationStore Annotations { get { throw null; } } - public TypeDefinition GetType (string fullName) { throw null; } - public string GetAssemblyLocation (AssemblyDefinition assembly) { throw null; } - public AssemblyDefinition GetLoadedAssembly (string name) { throw null; } + public static TypeDefinition GetType (string fullName) { throw null; } + public static string GetAssemblyLocation (AssemblyDefinition assembly) { throw null; } + public static AssemblyDefinition GetLoadedAssembly (string name) { throw null; } - public void LogMessage (MessageContainer message) { throw null; } + public static void LogMessage (MessageContainer message) { throw null; } - public bool HasCustomData (string key) { throw null; } - public bool TryGetCustomData (string key, out string value) { throw null; } + public static bool HasCustomData (string key) { throw null; } + public static bool TryGetCustomData (string key, out string value) { throw null; } public MethodDefinition Resolve (MethodReference methodReference) { throw null; } public FieldDefinition Resolve (FieldReference fieldReference) { throw null; } public TypeDefinition Resolve (TypeReference typeReference) { throw null; } - public MethodDefinition TryResolve (MethodReference methodReference) { throw null; } - public FieldDefinition TryResolve (FieldReference fieldReference) { throw null; } - public TypeDefinition TryResolve (TypeReference typeReference) { throw null; } + public static MethodDefinition TryResolve (MethodReference methodReference) { throw null; } + public static FieldDefinition TryResolve (FieldReference fieldReference) { throw null; } + public static TypeDefinition TryResolve (TypeReference typeReference) { throw null; } - public AssemblyDefinition Resolve (AssemblyNameReference nameReference) { throw null; } + public static AssemblyDefinition Resolve (AssemblyNameReference nameReference) { throw null; } } } diff --git a/src/linker/ref/Linker/OverrideInformation.cs b/src/linker/ref/Linker/OverrideInformation.cs index f33e94b71..4102b913e 100644 --- a/src/linker/ref/Linker/OverrideInformation.cs +++ b/src/linker/ref/Linker/OverrideInformation.cs @@ -11,9 +11,9 @@ namespace Mono.Linker { } - public MethodDefinition Base { get { throw null; } } - public MethodDefinition Override { get { throw null; } } - public InterfaceImplementation MatchingInterfaceImplementation { get { throw null; } } - public TypeDefinition InterfaceType { get { throw null; } } + public static MethodDefinition Base { get { throw null; } } + public static MethodDefinition Override { get { throw null; } } + public static InterfaceImplementation MatchingInterfaceImplementation { get { throw null; } } + public static TypeDefinition InterfaceType { get { throw null; } } } } |