Skip to content

Commit

Permalink
Undo unrelated formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jtschuster committed Aug 13, 2024
1 parent d6cc947 commit 01e4518
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 48 deletions.
94 changes: 47 additions & 47 deletions src/tools/illink/src/linker/Linker.Steps/MarkStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1483,17 +1483,17 @@ bool ProcessLazyAttributes ()
string attributeFullName = customAttribute.Constructor.DeclaringType.FullName;
switch (attributeFullName) {
case "System.Diagnostics.DebuggerDisplayAttribute": {
TypeDefinition? targetType = GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider);
if (targetType != null)
MarkTypeWithDebuggerDisplayAttribute (targetType, customAttribute, assemblyOrigin);
break;
}
TypeDefinition? targetType = GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider);
if (targetType != null)
MarkTypeWithDebuggerDisplayAttribute (targetType, customAttribute, assemblyOrigin);
break;
}
case "System.Diagnostics.DebuggerTypeProxyAttribute": {
TypeDefinition? targetType = GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider);
if (targetType != null)
MarkTypeWithDebuggerTypeProxyAttribute (targetType, customAttribute, assemblyOrigin);
break;
}
TypeDefinition? targetType = GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider);
if (targetType != null)
MarkTypeWithDebuggerTypeProxyAttribute (targetType, customAttribute, assemblyOrigin);
break;
}
}
}

Expand Down Expand Up @@ -3595,47 +3595,47 @@ protected virtual void MarkInstruction (Instruction instruction, MethodDefinitio
break;

case OperandType.InlineMethod: {
(DependencyKind dependencyKind, bool markForReflectionAccess) = instruction.OpCode.Code switch {
Code.Jmp => (DependencyKind.DirectCall, false),
Code.Call => (DependencyKind.DirectCall, false),
Code.Callvirt => (DependencyKind.VirtualCall, false),
Code.Newobj => (DependencyKind.Newobj, false),
Code.Ldvirtftn => (DependencyKind.Ldvirtftn, true),
Code.Ldftn => (DependencyKind.Ldftn, true),
_ => throw new InvalidOperationException ($"unexpected opcode {instruction.OpCode}")
};

MethodReference methodReference = (MethodReference) instruction.Operand;

requiresReflectionMethodBodyScanner |=
ReflectionMethodBodyScanner.RequiresReflectionMethodBodyScannerForCallSite (Context, methodReference);

origin = new MessageOrigin (origin, instruction.Offset);
if (markForReflectionAccess) {
MarkMethodVisibleToReflection (methodReference, new DependencyInfo (dependencyKind, method), origin);
} else {
MarkMethod (methodReference, new DependencyInfo (dependencyKind, method), origin);
(DependencyKind dependencyKind, bool markForReflectionAccess) = instruction.OpCode.Code switch {
Code.Jmp => (DependencyKind.DirectCall, false),
Code.Call => (DependencyKind.DirectCall, false),
Code.Callvirt => (DependencyKind.VirtualCall, false),
Code.Newobj => (DependencyKind.Newobj, false),
Code.Ldvirtftn => (DependencyKind.Ldvirtftn, true),
Code.Ldftn => (DependencyKind.Ldftn, true),
_ => throw new InvalidOperationException ($"unexpected opcode {instruction.OpCode}")
};

MethodReference methodReference = (MethodReference) instruction.Operand;

requiresReflectionMethodBodyScanner |=
ReflectionMethodBodyScanner.RequiresReflectionMethodBodyScannerForCallSite (Context, methodReference);

origin = new MessageOrigin (origin, instruction.Offset);
if (markForReflectionAccess) {
MarkMethodVisibleToReflection (methodReference, new DependencyInfo (dependencyKind, method), origin);
} else {
MarkMethod (methodReference, new DependencyInfo (dependencyKind, method), origin);
}
break;
}
break;
}

case OperandType.InlineTok: {
object token = instruction.Operand;
Debug.Assert (instruction.OpCode.Code == Code.Ldtoken);
var reason = new DependencyInfo (DependencyKind.Ldtoken, method);
origin = new MessageOrigin (origin, instruction.Offset);

if (token is TypeReference typeReference) {
// Error will be reported as part of MarkType
if (Context.TryResolve (typeReference) is TypeDefinition type)
MarkTypeVisibleToReflection (typeReference, type, reason, origin);
} else if (token is MethodReference methodReference) {
MarkMethodVisibleToReflection (methodReference, reason, origin);
} else {
MarkFieldVisibleToReflection ((FieldReference) token, reason, origin);
object token = instruction.Operand;
Debug.Assert (instruction.OpCode.Code == Code.Ldtoken);
var reason = new DependencyInfo (DependencyKind.Ldtoken, method);
origin = new MessageOrigin (origin, instruction.Offset);

if (token is TypeReference typeReference) {
// Error will be reported as part of MarkType
if (Context.TryResolve (typeReference) is TypeDefinition type)
MarkTypeVisibleToReflection (typeReference, type, reason, origin);
} else if (token is MethodReference methodReference) {
MarkMethodVisibleToReflection (methodReference, reason, origin);
} else {
MarkFieldVisibleToReflection ((FieldReference) token, reason, origin);
}
break;
}
break;
}

case OperandType.InlineType:
var operand = (TypeReference) instruction.Operand;
Expand Down
3 changes: 2 additions & 1 deletion src/tools/illink/src/linker/Linker/TypeMapInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ protected virtual void MapType (TypeDefinition type)
void MapInterfaceMethodsInTypeHierarchy (TypeDefinition type)
{
var runtimeInterfaceImpls = _recursiveInterfaces.GetRuntimeInterfaceImplementations (type);
if (runtimeInterfaceImpls.Length == 0) return;
if (runtimeInterfaceImpls.Length == 0)
return;

// Foreach interface and for each newslot virtual method on the interface, try
// to find the method implementation and record it.
Expand Down

0 comments on commit 01e4518

Please sign in to comment.