Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 46 additions & 8 deletions src/tools/illink/illink.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30524.135
# Visual Studio Version 17
VisualStudioVersion = 17.5.33209.295
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Linker", "src\linker\Mono.Linker.csproj", "{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}"
EndProject
Expand Down Expand Up @@ -33,16 +33,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tlens", "src\tlens\tlens.cs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.CodeFixProvider", "src\ILLink.CodeFix\ILLink.CodeFixProvider.csproj", "{6D20F334-B7E4-4585-854B-8A0E2B29B4AA}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ILLink.Shared", "src\ILLink.Shared\ILLink.Shared.shproj", "{92F5E753-2179-46DC-BDCE-736858C18DC7}"
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ILLink.Shared", "src\ILLink.Shared\ILLink.Shared.shproj", "{FF598E93-8E9E-4091-9F50-61A7572663AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.RoslynAnalyzer.Tests.Generator", "test\ILLink.RoslynAnalyzer.Tests.Generator\ILLink.RoslynAnalyzer.Tests.Generator.csproj", "{3DDE7064-4B68-4979-8843-FDF4CE5A5140}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "external", "external", "{8FD57ADB-B449-4960-A141-845C1E2E26EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "external\cecil\Mono.Cecil.csproj", "{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cecil", "cecil", "{223B8007-F26C-4E28-B28D-E43C97F7EE23}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "symbols", "symbols", "{19C783E3-B710-4F25-A977-0ADDA4D2CFEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Pdb", "external\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj", "{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\ILLink.Shared\ILLink.Shared.projitems*{92f5e753-2179-46dc-bdce-736858c18dc7}*SharedItemsImports = 13
src\ILLink.Shared\ILLink.Shared.projitems*{dd28e2b1-057b-4b4d-a04d-b2ebd9e76e46}*SharedItemsImports = 5
src\ILLink.Shared\ILLink.Shared.projitems*{f1a44a78-34ee-408b-8285-9a26f0e7d4f2}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -208,6 +213,30 @@ Global
{3DDE7064-4B68-4979-8843-FDF4CE5A5140}.Release|x64.Build.0 = Release|Any CPU
{3DDE7064-4B68-4979-8843-FDF4CE5A5140}.Release|x86.ActiveCfg = Release|Any CPU
{3DDE7064-4B68-4979-8843-FDF4CE5A5140}.Release|x86.Build.0 = Release|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Debug|x64.Build.0 = Debug|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Debug|x86.Build.0 = Debug|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Release|Any CPU.Build.0 = Release|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Release|x64.ActiveCfg = Release|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Release|x64.Build.0 = Release|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Release|x86.ActiveCfg = Release|Any CPU
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D}.Release|x86.Build.0 = Release|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Debug|x64.ActiveCfg = Debug|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Debug|x64.Build.0 = Debug|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Debug|x86.ActiveCfg = Debug|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Debug|x86.Build.0 = Debug|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Release|Any CPU.Build.0 = Release|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Release|x64.ActiveCfg = Release|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Release|x64.Build.0 = Release|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Release|x86.ActiveCfg = Release|Any CPU
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -223,8 +252,17 @@ Global
{8DA71B3B-5809-44E5-A018-5DE5C6FF6C2A} = {03EB085F-3E2E-4A68-A7DF-951ADF59A0CC}
{6D20F334-B7E4-4585-854B-8A0E2B29B4AA} = {AA0569FB-73E9-4B42-9A19-714BB1229DAE}
{3DDE7064-4B68-4979-8843-FDF4CE5A5140} = {C2969923-7BAA-4FE4-853C-F670B0D3C6C8}
{7C068318-84AF-4861-9E5F-6F8A3BF38C9D} = {8FD57ADB-B449-4960-A141-845C1E2E26EC}
{223B8007-F26C-4E28-B28D-E43C97F7EE23} = {8FD57ADB-B449-4960-A141-845C1E2E26EC}
{19C783E3-B710-4F25-A977-0ADDA4D2CFEE} = {223B8007-F26C-4E28-B28D-E43C97F7EE23}
{AF7722A0-D1A7-4294-A181-B88B6BD67C6E} = {19C783E3-B710-4F25-A977-0ADDA4D2CFEE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E43A3901-42B0-48CA-BB36-5CD40A99A6EE}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\ILLink.Shared\ILLink.Shared.projitems*{dd28e2b1-057b-4b4d-a04d-b2ebd9e76e46}*SharedItemsImports = 5
src\ILLink.Shared\ILLink.Shared.projitems*{f1a44a78-34ee-408b-8285-9a26f0e7d4f2}*SharedItemsImports = 5
src\ILLink.Shared\ILLink.Shared.projitems*{ff598e93-8e9e-4091-9f50-61a7572663ae}*SharedItemsImports = 13
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ partial struct ParameterProxy
{
public ParameterProxy (IParameterSymbol parameter)
{
Method = (new ((IMethodSymbol) parameter.ContainingSymbol));
Method = new ((IMethodSymbol) parameter.ContainingSymbol);
Index = (ParameterIndex) parameter.Ordinal + (Method.HasImplicitThis () ? 1 : 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,8 @@ public DefaultValueDictionary<TKey, TValue> Clone ()
// Prevent warning CS0659 https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0659.
// This type should never be used as a dictionary key.
public override int GetHashCode () => throw new NotImplementedException ();

public static bool operator == (DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => left.Equals (right);
public static bool operator != (DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => !(left == right);
}
}
3 changes: 3 additions & 0 deletions src/tools/illink/src/ILLink.Shared/DataFlow/MaybeLattice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public Maybe<T> Clone ()
return new (copyValue.DeepCopy ());
return new (value);
}

public static bool operator == (Maybe<T> left, Maybe<T> right) => left.Equals (right);
public static bool operator != (Maybe<T> left, Maybe<T> right) => !(left == right);
}

public struct MaybeLattice<T, TValueLattice> : ILattice<Maybe<T>>
Expand Down
3 changes: 3 additions & 0 deletions src/tools/illink/src/ILLink.Shared/DataFlow/ValueSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public bool Equals (ValueSet<TValue> other)
}
}

public static bool operator == (ValueSet<TValue> left, ValueSet<TValue> right) => left.Equals (right);
public static bool operator != (ValueSet<TValue> left, ValueSet<TValue> right) => !(left == right);

public override int GetHashCode ()
{
if (_values == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static (string Namespace, string Name) GetNamespaceAndName (this WellKnow
WellKnownType.System_NotSupportedException => ("System", "NotSupportedException"),
WellKnownType.System_Runtime_CompilerServices_DisablePrivateReflectionAttribute => ("System.Runtime.CompilerServices", "DisablePrivateReflectionAttribute"),
WellKnownType.System_Void => ("System", "Void"),
_ => throw new System.ArgumentException (type.ToString ())
};
}
public static string GetNamespace (this WellKnownType type) => GetNamespaceAndName (type).Namespace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ public HoistedLocalKey (FieldDefinition field)
public override bool Equals (object? obj) => obj is HoistedLocalKey other && Equals (other);

public override int GetHashCode () => Field.GetHashCode ();

public static bool operator == (HoistedLocalKey left, HoistedLocalKey right) => left.Equals (right);
public static bool operator != (HoistedLocalKey left, HoistedLocalKey right) => !(left == right);
}
}
3 changes: 3 additions & 0 deletions src/tools/illink/src/linker/Linker.Dataflow/ValueNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,8 @@ public ValueBasicBlockPair (MultiValue value, int basicBlockIndex)
public override bool Equals (object? obj) => obj is ValueBasicBlockPair other && Equals (other);

public override int GetHashCode () => HashUtils.Combine (Value.GetHashCode (), BasicBlockIndex);

public static bool operator == (ValueBasicBlockPair left, ValueBasicBlockPair right) => left.Equals (right);
public static bool operator != (ValueBasicBlockPair left, ValueBasicBlockPair right) => !(left == right);
}
}
2 changes: 1 addition & 1 deletion src/tools/illink/src/linker/Linker.Steps/MarkStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ protected void MarkField (FieldReference reference, DependencyInfo reason, in Me
Debug.Assert (reason.Kind == DependencyKind.FieldAccess || reason.Kind == DependencyKind.Ldtoken);
// Blame the field reference (without actually marking) on the original reason.
Tracer.AddDirectDependency (reference, reason, marked: false);
MarkType (reference.DeclaringType, new DependencyInfo (DependencyKind.DeclaringType, reference), new MessageOrigin (Context.TryResolve (reference)));
MarkType (reference.DeclaringType, new DependencyInfo (DependencyKind.DeclaringType, reference));

// Blame the field definition that we will resolve on the field reference.
reason = new DependencyInfo (DependencyKind.FieldOnGenericInstance, reference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,7 @@ static bool IsMessageMatch (Diagnostic actual, ImmutableArray<string> actualArgu

public MatchQuality (int value)
{
if (value < 0) {
throw new ArgumentOutOfRangeException (nameof (value));
}
ArgumentOutOfRangeException.ThrowIfNegative (value);

_value = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public class ExpectedInstructionSequenceAttribute : BaseInAssemblyAttribute
{
public ExpectedInstructionSequenceAttribute (string[] opCodes)
{
if (opCodes == null)
throw new ArgumentNullException (nameof (opCodes));
ArgumentNullException.ThrowIfNull (opCodes);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ public ExpectedInstructionSequenceOnMemberInAssemblyAttribute (string assemblyFi
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (memberName))
throw new ArgumentNullException (nameof (memberName));
if (opCodes == null)
throw new ArgumentNullException (nameof (opCodes));
ArgumentNullException.ThrowIfNull (opCodes);
}

public ExpectedInstructionSequenceOnMemberInAssemblyAttribute (string assemblyFileName, string typeName, string memberName, string[] opCodes)
Expand All @@ -28,8 +26,7 @@ public ExpectedInstructionSequenceOnMemberInAssemblyAttribute (string assemblyFi
throw new ArgumentNullException (nameof (typeName));
if (string.IsNullOrEmpty (memberName))
throw new ArgumentNullException (nameof (memberName));
if (opCodes == null)
throw new ArgumentNullException (nameof (opCodes));
ArgumentNullException.ThrowIfNull (opCodes);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ public class ExpectedLocalsSequenceAttribute : BaseInAssemblyAttribute
{
public ExpectedLocalsSequenceAttribute (string[] types)
{
if (types == null)
throw new ArgumentNullException (nameof (types));
ArgumentNullException.ThrowIfNull (types);
}

public ExpectedLocalsSequenceAttribute (Type[] types)
{
if (types == null)
throw new ArgumentNullException (nameof (types));
ArgumentNullException.ThrowIfNull (types);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public class IgnoreTestCaseAttribute : Attribute

public IgnoreTestCaseAttribute (string reason)
{
if (reason == null)
throw new ArgumentNullException (nameof (reason));
ArgumentNullException.ThrowIfNull (reason);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public KeptAttributeAttribute (string attributeName)

public KeptAttributeAttribute (Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public KeptAttributeOnFixedBufferTypeAttribute (string attributeName)

public KeptAttributeOnFixedBufferTypeAttribute (Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public class KeptBaseOnTypeInAssemblyAttribute : BaseInAssemblyAttribute
{
public KeptBaseOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string baseAssemblyFileName, Type baseType)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ public sealed class KeptBaseTypeAttribute : KeptAttribute
{
public KeptBaseTypeAttribute (Type baseType)
{
if (baseType == null)
throw new ArgumentNullException (nameof (baseType));
ArgumentNullException.ThrowIfNull (baseType);
}

public KeptBaseTypeAttribute (Type baseType, params object[] typeArguments)
{
if (baseType == null)
throw new ArgumentNullException (nameof (baseType));
if (typeArguments == null)
throw new ArgumentNullException (nameof (typeArguments));
ArgumentNullException.ThrowIfNull (baseType);
ArgumentNullException.ThrowIfNull (typeArguments);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class KeptExportedTypeAttribute : KeptAttribute
{
public KeptExportedTypeAttribute (Type type)
{
if (type is null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public KeptInitializerData ()

public KeptInitializerData (int occurrenceIndexInBody)
{
if (occurrenceIndexInBody < 0)
throw new ArgumentOutOfRangeException (nameof (occurrenceIndexInBody));
ArgumentOutOfRangeException.ThrowIfNegative (occurrenceIndexInBody);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ public class KeptInterfaceAttribute : KeptAttribute

public KeptInterfaceAttribute (Type interfaceType)
{
if (interfaceType == null)
throw new ArgumentNullException (nameof (interfaceType));
ArgumentNullException.ThrowIfNull (interfaceType);
}

public KeptInterfaceAttribute (Type interfaceType, params object[] typeArguments)
{
if (interfaceType == null)
throw new ArgumentNullException (nameof (interfaceType));
if (typeArguments == null)
throw new ArgumentNullException (nameof (typeArguments));
ArgumentNullException.ThrowIfNull (interfaceType);
ArgumentNullException.ThrowIfNull (typeArguments);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public class KeptInterfaceOnTypeInAssemblyAttribute : BaseInAssemblyAttribute
{
public KeptInterfaceOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string interfaceAssemblyFileName, Type interfaceType)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ public KeptMemberInAssemblyAttribute (string assemblyFileName, Type type, params
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (type == null)
throw new ArgumentNullException (nameof (type));
if (memberNames == null)
throw new ArgumentNullException (nameof (memberNames));
ArgumentNullException.ThrowIfNull (type);
ArgumentNullException.ThrowIfNull (memberNames);
}

public KeptMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string[] memberNames)
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (typeName == null)
throw new ArgumentNullException (nameof (typeName));
if (memberNames == null)
throw new ArgumentNullException (nameof (memberNames));
ArgumentNullException.ThrowIfNull (typeName);
ArgumentNullException.ThrowIfNull (memberNames);
}

public string ExpectationAssemblyName { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public class KeptOverrideAttribute : KeptAttribute

public KeptOverrideAttribute (Type typeWithOverriddenMethod)
{
if (typeWithOverriddenMethod == null)
throw new ArgumentNullException (nameof (typeWithOverriddenMethod));
ArgumentNullException.ThrowIfNull (typeWithOverriddenMethod);
TypeWithOverriddenMethodDeclaration = typeWithOverriddenMethod;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public KeptReferencesInAssemblyAttribute (string assemblyFileName, string[] expe
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));

if (expectedReferenceAssemblyNames == null)
throw new ArgumentNullException (nameof (expectedReferenceAssemblyNames));
ArgumentNullException.ThrowIfNull (expectedReferenceAssemblyNames);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public KeptSecurityAttribute (string attributeName)

public KeptSecurityAttribute (Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}
Loading