Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DiagnosticName in NativeAOT code #63271

Merged
merged 1 commit into from
Jan 3, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ public abstract partial class GenericParameterDesc
/// <summary>
/// Gets the name of the generic parameter as defined in the metadata. This must not throw
/// </summary>
public abstract string DiagnosticName { get; }
public virtual string DiagnosticName
{
get
{
return string.Concat("T", Index.ToStringInvariant());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return $"GetExecutingAssembly_{ExecutingAssembly.GetName().Name}";
}
}

public override TypeDesc OwningType
{
get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return "CalliMarshallingMethodThunk";
}
}

public override PInvokeMetadata GetPInvokeMethodMetadata()
{
// Return PInvokeAttributes.PreserveSig to circumvent marshalling required checks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return NamePrefix + "__" + DelegateType.DiagnosticName;
}
}

public override MethodIL EmitIL()
{
return PInvokeILEmitter.EmitIL(this, default(PInvokeILEmitterConfiguration), _interopStateManager);
Expand Down
16 changes: 16 additions & 0 deletions src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ protected FieldDesc FunctionPointerField
return SystemDelegateType.GetKnownField("m_functionPointer");
}
}

public sealed override string DiagnosticName
{
get
{
return Name;
}
}
}

/// <summary>
Expand Down Expand Up @@ -779,5 +787,13 @@ public override string Name
return "GetThunk";
}
}

public override string DiagnosticName
{
get
{
return "GetThunk";
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return Name;
}
}

public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
Expand Down
16 changes: 16 additions & 0 deletions src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return "GetHashCode";
}
}

public override bool IsVirtual
{
get
Expand Down Expand Up @@ -147,6 +155,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return "Equals";
}
}

public override bool IsVirtual
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return "ForwardDelegateCreationStub__" + DelegateType.DiagnosticName;
}
}

/// <summary>
/// This thunk creates a delegate from a native function pointer
/// by first creating a PInvokeDelegateWrapper from the function pointer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return Method.DiagnosticName;
}
}

public override TypeDesc OwningType
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return NamePrefix + "__" + ManagedType.DiagnosticName;
}
}

private Marshaller[] InitializeMarshallers()
{
Debug.Assert(_interopStateManager != null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return $"{_helperMethod.DiagnosticName}_{Signature.Length}_{DefaultAssemblyName}";
}
}

public override TypeDesc OwningType
{
get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,13 @@ public override string Name
return "__GetFieldHelper";
}
}

public override string DiagnosticName
{
get
{
return "__GetFieldHelper";
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ public override string Name
get;
}

public override string DiagnosticName
{
get
{
return Name;
}
}

public override string Namespace
{
get
Expand All @@ -97,6 +105,14 @@ public override string Namespace
}
}

public override string DiagnosticNamespace
{
get
{
return "Internal.CompilerGenerated";
}
}

public override int GetHashCode()
{
if (_hashcode != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return "_InlineArray__" + ElementType.DiagnosticName + "__" + Length;
}
}

public override string Namespace
{
get
Expand All @@ -43,6 +51,14 @@ public override string Namespace
}
}

public override string DiagnosticNamespace
{
get
{
return Namespace;
}
}

public override Instantiation Instantiation
{
get
Expand Down Expand Up @@ -320,6 +336,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return Name;
}
}

public override MethodSignature Signature
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return "__NativeType__" + ManagedStructType.DiagnosticName;
}
}

public override string Namespace
{
get
Expand All @@ -36,6 +44,14 @@ public override string Namespace
}
}

public override string DiagnosticNamespace
{
get
{
return "Internal.CompilerGenerated";
}
}

public override PInvokeStringFormat PInvokeStringFormat
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return "PInvokeDelegateWrapper__" + DelegateType.DiagnosticName;
}
}

public override string Namespace
{
get
Expand All @@ -43,6 +51,14 @@ public override string Namespace
}
}

public override string DiagnosticNamespace
{
get
{
return "Internal.CompilerGenerated";
}
}

public override bool IsExplicitLayout
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public override string Name
}
}

public override string DiagnosticName
{
get
{
return ".ctor";
}
}

private MethodSignature _signature;
public override MethodSignature Signature
{
Expand Down
Loading