diff --git a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs index 977bcdebaf49e5..80b9722732649f 100644 --- a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs +++ b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs @@ -3164,20 +3164,9 @@ void MarkMethodCollection(IList methods, in DependencyInfo rea if (method == null) return null; - var methodAction = Annotations.GetAction(method); - if (methodAction is MethodAction.ConvertToStub) - { - // CodeRewriterStep may request the stubbed value for any preserved method - // with the action ConvertToStub. Ensure we have precomputed any stub value that may be needed by - // CodeRewriterStep. This ensures sweeping doesn't change the stub value (which can be determined by - // FeatureGuardAttribute or FeatureSwitchDefinitionAttribute that might have been removed). - Annotations.TryGetMethodStubValue(method, out _); - } - - if (methodAction == MethodAction.Nothing) + if (Annotations.GetAction(method) == MethodAction.Nothing) Annotations.SetAction(method, MethodAction.Parse); - // Use the original reason as it's important to correctly generate warnings // the updated reason is only useful for better tracking of dependencies. ProcessAnalysisAnnotationsForMethod(method, originalReason.Kind, origin); diff --git a/src/tools/illink/src/linker/Linker/MemberActionStore.cs b/src/tools/illink/src/linker/Linker/MemberActionStore.cs index d43c34ac1c6429..c06fe97b9c349e 100644 --- a/src/tools/illink/src/linker/Linker/MemberActionStore.cs +++ b/src/tools/illink/src/linker/Linker/MemberActionStore.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using ILLink.Shared; using Mono.Cecil; @@ -13,14 +12,12 @@ public class MemberActionStore { public SubstitutionInfo PrimarySubstitutionInfo { get; } private readonly Dictionary _embeddedXmlInfos; - private readonly Dictionary _featureCheckValues; readonly LinkContext _context; public MemberActionStore(LinkContext context) { PrimarySubstitutionInfo = new SubstitutionInfo(); _embeddedXmlInfos = new Dictionary(); - _featureCheckValues = new Dictionary(); _context = context; } @@ -73,9 +70,6 @@ public bool TryGetMethodStubValue(MethodDefinition method, out object? value) internal bool TryGetFeatureCheckValue(MethodDefinition method, out bool value) { - if (_featureCheckValues.TryGetValue(method, out value)) - return true; - value = false; if (!method.IsStatic) @@ -98,10 +92,7 @@ internal bool TryGetFeatureCheckValue(MethodDefinition method, out bool value) // If there's a FeatureSwitchDefinition, don't continue looking for FeatureGuard. // We don't want to infer feature switch settings from FeatureGuard. if (_context.FeatureSettings.TryGetValue(switchName, out value)) - { - _featureCheckValues[method] = value; return true; - } return false; } @@ -118,17 +109,13 @@ internal bool TryGetFeatureCheckValue(MethodDefinition method, out bool value) switch (featureType.Name) { case "RequiresUnreferencedCodeAttribute": - _featureCheckValues[method] = value; return true; case "RequiresDynamicCodeAttribute": if (_context.FeatureSettings.TryGetValue( "System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported", out bool isDynamicCodeSupported) && !isDynamicCodeSupported) - { - _featureCheckValues[method] = value; return true; - } break; } }