Skip to content

Commit baaad1e

Browse files
authored
[cDAC] Remove superfluous modifiers from contract interfaces (#113983)
* remove superfluous modifiers `public virtual` from contract interfaces
1 parent ef7ee5d commit baaad1e

File tree

9 files changed

+71
-71
lines changed

9 files changed

+71
-71
lines changed

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IDacStreams.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.Diagnostics.DataContractReader.Contracts;
88
public interface IDacStreams : IContract
99
{
1010
static string IContract.Name { get; } = nameof(DacStreams);
11-
public virtual string? StringFromEEAddress(TargetPointer address) => throw new NotImplementedException();
11+
string? StringFromEEAddress(TargetPointer address) => throw new NotImplementedException();
1212
}
1313

1414
public readonly struct DacStreams : IDacStreams

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IEcmaMetadata.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace Microsoft.Diagnostics.DataContractReader.Contracts;
99
public interface IEcmaMetadata : IContract
1010
{
1111
static string IContract.Name { get; } = nameof(EcmaMetadata);
12-
public virtual TargetSpan GetReadOnlyMetadataAddress(ModuleHandle handle) => throw new NotImplementedException();
13-
public virtual MetadataReader? GetMetadata(ModuleHandle module) => throw new NotImplementedException();
12+
TargetSpan GetReadOnlyMetadataAddress(ModuleHandle handle) => throw new NotImplementedException();
13+
MetadataReader? GetMetadata(ModuleHandle module) => throw new NotImplementedException();
1414
}
1515

1616
public readonly struct EcmaMetadata : IEcmaMetadata

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public interface IException : IContract
1919
{
2020
static string IContract.Name { get; } = nameof(Exception);
2121

22-
public virtual TargetPointer GetNestedExceptionInfo(TargetPointer exception, out TargetPointer nextNestedException) => throw new NotImplementedException();
23-
public virtual ExceptionData GetExceptionData(TargetPointer managedException) => throw new NotImplementedException();
22+
TargetPointer GetNestedExceptionInfo(TargetPointer exception, out TargetPointer nextNestedException) => throw new NotImplementedException();
23+
ExceptionData GetExceptionData(TargetPointer managedException) => throw new NotImplementedException();
2424
}
2525

2626
public readonly struct Exception : IException

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/ILoader.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ public interface ILoader : IContract
3636
{
3737
static string IContract.Name => nameof(Loader);
3838

39-
public virtual ModuleHandle GetModuleHandle(TargetPointer modulePointer) => throw new NotImplementedException();
39+
ModuleHandle GetModuleHandle(TargetPointer modulePointer) => throw new NotImplementedException();
4040

41-
public virtual TargetPointer GetAssembly(ModuleHandle handle) => throw new NotImplementedException();
42-
public virtual ModuleFlags GetFlags(ModuleHandle handle) => throw new NotImplementedException();
43-
public virtual string GetPath(ModuleHandle handle) => throw new NotImplementedException();
44-
public virtual string GetFileName(ModuleHandle handle) => throw new NotImplementedException();
41+
TargetPointer GetAssembly(ModuleHandle handle) => throw new NotImplementedException();
42+
ModuleFlags GetFlags(ModuleHandle handle) => throw new NotImplementedException();
43+
string GetPath(ModuleHandle handle) => throw new NotImplementedException();
44+
string GetFileName(ModuleHandle handle) => throw new NotImplementedException();
4545

46-
public virtual TargetPointer GetLoaderAllocator(ModuleHandle handle) => throw new NotImplementedException();
47-
public virtual TargetPointer GetILBase(ModuleHandle handle) => throw new NotImplementedException();
48-
public virtual ModuleLookupTables GetLookupTables(ModuleHandle handle) => throw new NotImplementedException();
46+
TargetPointer GetLoaderAllocator(ModuleHandle handle) => throw new NotImplementedException();
47+
TargetPointer GetILBase(ModuleHandle handle) => throw new NotImplementedException();
48+
ModuleLookupTables GetLookupTables(ModuleHandle handle) => throw new NotImplementedException();
4949

50-
public virtual TargetPointer GetModuleLookupMapElement(TargetPointer table, uint token, out TargetNUInt flags) => throw new NotImplementedException();
51-
public virtual bool IsCollectible(ModuleHandle handle) => throw new NotImplementedException();
50+
TargetPointer GetModuleLookupMapElement(TargetPointer table, uint token, out TargetNUInt flags) => throw new NotImplementedException();
51+
bool IsCollectible(ModuleHandle handle) => throw new NotImplementedException();
5252
}
5353

5454
public readonly struct Loader : ILoader

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IObject.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ namespace Microsoft.Diagnostics.DataContractReader.Contracts;
88
public interface IObject : IContract
99
{
1010
static string IContract.Name { get; } = nameof(Object);
11-
public virtual TargetPointer GetMethodTableAddress(TargetPointer address) => throw new NotImplementedException();
12-
public virtual string GetStringValue(TargetPointer address) => throw new NotImplementedException();
13-
public virtual TargetPointer GetArrayData(TargetPointer address, out uint count, out TargetPointer boundsStart, out TargetPointer lowerBounds) => throw new NotImplementedException();
14-
public virtual bool GetBuiltInComData(TargetPointer address, out TargetPointer rcw, out TargetPointer ccw) => throw new NotImplementedException();
11+
TargetPointer GetMethodTableAddress(TargetPointer address) => throw new NotImplementedException();
12+
string GetStringValue(TargetPointer address) => throw new NotImplementedException();
13+
TargetPointer GetArrayData(TargetPointer address, out uint count, out TargetPointer boundsStart, out TargetPointer lowerBounds) => throw new NotImplementedException();
14+
bool GetBuiltInComData(TargetPointer address, out TargetPointer rcw, out TargetPointer ccw) => throw new NotImplementedException();
1515
}
1616

1717
public readonly struct Object : IObject

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeTypeSystem.cs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -80,96 +80,96 @@ public interface IRuntimeTypeSystem : IContract
8080
static string IContract.Name => nameof(RuntimeTypeSystem);
8181

8282
#region TypeHandle inspection APIs
83-
public virtual TypeHandle GetTypeHandle(TargetPointer address) => throw new NotImplementedException();
84-
public virtual TargetPointer GetModule(TypeHandle typeHandle) => throw new NotImplementedException();
83+
TypeHandle GetTypeHandle(TargetPointer address) => throw new NotImplementedException();
84+
TargetPointer GetModule(TypeHandle typeHandle) => throw new NotImplementedException();
8585

8686
// A canonical method table is either the MethodTable itself, or in the case of a generic instantiation, it is the
8787
// MethodTable of the prototypical instance.
88-
public virtual TargetPointer GetCanonicalMethodTable(TypeHandle typeHandle) => throw new NotImplementedException();
89-
public virtual TargetPointer GetParentMethodTable(TypeHandle typeHandle) => throw new NotImplementedException();
88+
TargetPointer GetCanonicalMethodTable(TypeHandle typeHandle) => throw new NotImplementedException();
89+
TargetPointer GetParentMethodTable(TypeHandle typeHandle) => throw new NotImplementedException();
9090

91-
public virtual uint GetBaseSize(TypeHandle typeHandle) => throw new NotImplementedException();
91+
uint GetBaseSize(TypeHandle typeHandle) => throw new NotImplementedException();
9292
// The component size is only available for strings and arrays. It is the size of the element type of the array, or the size of an ECMA 335 character (2 bytes)
93-
public virtual uint GetComponentSize(TypeHandle typeHandle) => throw new NotImplementedException();
93+
uint GetComponentSize(TypeHandle typeHandle) => throw new NotImplementedException();
9494

9595
// True if the MethodTable is the sentinel value associated with unallocated space in the managed heap
96-
public virtual bool IsFreeObjectMethodTable(TypeHandle typeHandle) => throw new NotImplementedException();
97-
public virtual bool IsString(TypeHandle typeHandle) => throw new NotImplementedException();
96+
bool IsFreeObjectMethodTable(TypeHandle typeHandle) => throw new NotImplementedException();
97+
bool IsString(TypeHandle typeHandle) => throw new NotImplementedException();
9898
// True if the MethodTable represents a type that contains managed references
99-
public virtual bool ContainsGCPointers(TypeHandle typeHandle) => throw new NotImplementedException();
100-
public virtual bool IsDynamicStatics(TypeHandle typeHandle) => throw new NotImplementedException();
101-
public virtual ushort GetNumMethods(TypeHandle typeHandle) => throw new NotImplementedException();
102-
public virtual ushort GetNumInterfaces(TypeHandle typeHandle) => throw new NotImplementedException();
99+
bool ContainsGCPointers(TypeHandle typeHandle) => throw new NotImplementedException();
100+
bool IsDynamicStatics(TypeHandle typeHandle) => throw new NotImplementedException();
101+
ushort GetNumMethods(TypeHandle typeHandle) => throw new NotImplementedException();
102+
ushort GetNumInterfaces(TypeHandle typeHandle) => throw new NotImplementedException();
103103

104104
// Returns an ECMA-335 TypeDef table token for this type, or for its generic type definition if it is a generic instantiation
105-
public virtual uint GetTypeDefToken(TypeHandle typeHandle) => throw new NotImplementedException();
105+
uint GetTypeDefToken(TypeHandle typeHandle) => throw new NotImplementedException();
106106
// Returns the ECMA 335 TypeDef table Flags value (a bitmask of TypeAttributes) for this type,
107107
// or for its generic type definition if it is a generic instantiation
108-
public virtual uint GetTypeDefTypeAttributes(TypeHandle typeHandle) => throw new NotImplementedException();
108+
uint GetTypeDefTypeAttributes(TypeHandle typeHandle) => throw new NotImplementedException();
109109

110-
public virtual ReadOnlySpan<TypeHandle> GetInstantiation(TypeHandle typeHandle) => throw new NotImplementedException();
111-
public virtual bool IsGenericTypeDefinition(TypeHandle typeHandle) => throw new NotImplementedException();
110+
ReadOnlySpan<TypeHandle> GetInstantiation(TypeHandle typeHandle) => throw new NotImplementedException();
111+
bool IsGenericTypeDefinition(TypeHandle typeHandle) => throw new NotImplementedException();
112112

113-
public virtual bool HasTypeParam(TypeHandle typeHandle) => throw new NotImplementedException();
113+
bool HasTypeParam(TypeHandle typeHandle) => throw new NotImplementedException();
114114

115115
// Element type of the type. NOTE: this drops the CorElementType.GenericInst, and CorElementType.String is returned as CorElementType.Class.
116116
// If this returns CorElementType.ValueType it may be a normal valuetype or a "NATIVE" valuetype used to represent an interop view on a structure
117117
// HasTypeParam will return true for cases where this is the interop view
118-
public virtual CorElementType GetSignatureCorElementType(TypeHandle typeHandle) => throw new NotImplementedException();
118+
CorElementType GetSignatureCorElementType(TypeHandle typeHandle) => throw new NotImplementedException();
119119

120120
// return true if the TypeHandle represents an array, and set the rank to either 0 (if the type is not an array), or the rank number if it is.
121-
public virtual bool IsArray(TypeHandle typeHandle, out uint rank) => throw new NotImplementedException();
122-
public virtual TypeHandle GetTypeParam(TypeHandle typeHandle) => throw new NotImplementedException();
123-
public virtual bool IsGenericVariable(TypeHandle typeHandle, out TargetPointer module, out uint token) => throw new NotImplementedException();
124-
public virtual bool IsFunctionPointer(TypeHandle typeHandle, out ReadOnlySpan<TypeHandle> retAndArgTypes, out byte callConv) => throw new NotImplementedException();
121+
bool IsArray(TypeHandle typeHandle, out uint rank) => throw new NotImplementedException();
122+
TypeHandle GetTypeParam(TypeHandle typeHandle) => throw new NotImplementedException();
123+
bool IsGenericVariable(TypeHandle typeHandle, out TargetPointer module, out uint token) => throw new NotImplementedException();
124+
bool IsFunctionPointer(TypeHandle typeHandle, out ReadOnlySpan<TypeHandle> retAndArgTypes, out byte callConv) => throw new NotImplementedException();
125125
// Returns null if the TypeHandle is not a class/struct/generic variable
126126
#endregion TypeHandle inspection APIs
127127

128128
#region MethodDesc inspection APIs
129-
public virtual MethodDescHandle GetMethodDescHandle(TargetPointer targetPointer) => throw new NotImplementedException();
130-
public virtual TargetPointer GetMethodTable(MethodDescHandle methodDesc) => throw new NotImplementedException();
129+
MethodDescHandle GetMethodDescHandle(TargetPointer targetPointer) => throw new NotImplementedException();
130+
TargetPointer GetMethodTable(MethodDescHandle methodDesc) => throw new NotImplementedException();
131131

132132
// Return true for an uninstantiated generic method
133-
public virtual bool IsGenericMethodDefinition(MethodDescHandle methodDesc) => throw new NotImplementedException();
134-
public virtual ReadOnlySpan<TypeHandle> GetGenericMethodInstantiation(MethodDescHandle methodDesc) => throw new NotImplementedException();
133+
bool IsGenericMethodDefinition(MethodDescHandle methodDesc) => throw new NotImplementedException();
134+
ReadOnlySpan<TypeHandle> GetGenericMethodInstantiation(MethodDescHandle methodDesc) => throw new NotImplementedException();
135135

136136
// Return mdtMethodDef (0x06000000) if the method doesn't have a token, otherwise return the token of the method
137-
public virtual uint GetMethodToken(MethodDescHandle methodDesc) => throw new NotImplementedException();
137+
uint GetMethodToken(MethodDescHandle methodDesc) => throw new NotImplementedException();
138138

139139
// Return true if a MethodDesc represents an array method
140140
// An array method is also a StoredSigMethodDesc
141-
public virtual bool IsArrayMethod(MethodDescHandle methodDesc, out ArrayFunctionType functionType) => throw new NotImplementedException();
141+
bool IsArrayMethod(MethodDescHandle methodDesc, out ArrayFunctionType functionType) => throw new NotImplementedException();
142142

143143
// Return true if a MethodDesc represents a method without metadata, either an IL Stub dynamically
144144
// generated by the runtime, or a MethodDesc that describes a method represented by the System.Reflection.Emit.DynamicMethod class
145145
// Or something else similar.
146146
// A no metadata method is also a StoredSigMethodDesc
147-
public virtual bool IsNoMetadataMethod(MethodDescHandle methodDesc, out string methodName) => throw new NotImplementedException();
147+
bool IsNoMetadataMethod(MethodDescHandle methodDesc, out string methodName) => throw new NotImplementedException();
148148
// A StoredSigMethodDesc is a MethodDesc for which the signature isn't found in metadata.
149-
public virtual bool IsStoredSigMethodDesc(MethodDescHandle methodDesc, out ReadOnlySpan<byte> signature) => throw new NotImplementedException();
149+
bool IsStoredSigMethodDesc(MethodDescHandle methodDesc, out ReadOnlySpan<byte> signature) => throw new NotImplementedException();
150150

151151
// Return true for a MethodDesc that describes a method represented by the System.Reflection.Emit.DynamicMethod class
152152
// A DynamicMethod is also a StoredSigMethodDesc, and a NoMetadataMethod
153-
public virtual bool IsDynamicMethod(MethodDescHandle methodDesc) => throw new NotImplementedException();
153+
bool IsDynamicMethod(MethodDescHandle methodDesc) => throw new NotImplementedException();
154154

155155
// Return true if a MethodDesc represents an IL Stub dynamically generated by the runtime
156156
// A IL Stub method is also a StoredSigMethodDesc, and a NoMetadataMethod
157-
public virtual bool IsILStub(MethodDescHandle methodDesc) => throw new NotImplementedException();
157+
bool IsILStub(MethodDescHandle methodDesc) => throw new NotImplementedException();
158158

159-
public virtual bool IsCollectibleMethod(MethodDescHandle methodDesc) => throw new NotImplementedException();
160-
public virtual bool IsVersionable(MethodDescHandle methodDesc) => throw new NotImplementedException();
159+
bool IsCollectibleMethod(MethodDescHandle methodDesc) => throw new NotImplementedException();
160+
bool IsVersionable(MethodDescHandle methodDesc) => throw new NotImplementedException();
161161

162-
public virtual TargetPointer GetMethodDescVersioningState(MethodDescHandle methodDesc) => throw new NotImplementedException();
162+
TargetPointer GetMethodDescVersioningState(MethodDescHandle methodDesc) => throw new NotImplementedException();
163163

164-
public virtual TargetCodePointer GetNativeCode(MethodDescHandle methodDesc) => throw new NotImplementedException();
164+
TargetCodePointer GetNativeCode(MethodDescHandle methodDesc) => throw new NotImplementedException();
165165

166-
public virtual ushort GetSlotNumber(MethodDescHandle methodDesc) => throw new NotImplementedException();
166+
ushort GetSlotNumber(MethodDescHandle methodDesc) => throw new NotImplementedException();
167167

168-
public virtual bool HasNativeCodeSlot(MethodDescHandle methodDesc) => throw new NotImplementedException();
168+
bool HasNativeCodeSlot(MethodDescHandle methodDesc) => throw new NotImplementedException();
169169

170-
public virtual TargetPointer GetAddressOfNativeCodeSlot(MethodDescHandle methodDesc) => throw new NotImplementedException();
170+
TargetPointer GetAddressOfNativeCodeSlot(MethodDescHandle methodDesc) => throw new NotImplementedException();
171171

172-
public virtual TargetPointer GetGCStressCodeCopy(MethodDescHandle methodDesc) => throw new NotImplementedException();
172+
TargetPointer GetGCStressCodeCopy(MethodDescHandle methodDesc) => throw new NotImplementedException();
173173
#endregion MethodDesc inspection APIs
174174
}
175175

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IStackWalk.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public interface IStackWalk : IContract
1313
static string IContract.Name => nameof(StackWalk);
1414

1515
public virtual IEnumerable<IStackDataFrameHandle> CreateStackWalk(ThreadData threadData) => throw new NotImplementedException();
16-
public virtual byte[] GetRawContext(IStackDataFrameHandle stackDataFrameHandle) => throw new NotImplementedException();
17-
public virtual TargetPointer GetFrameAddress(IStackDataFrameHandle stackDataFrameHandle) => throw new NotImplementedException();
18-
public virtual string GetFrameName(TargetPointer frameIdentifier) => throw new NotImplementedException();
16+
byte[] GetRawContext(IStackDataFrameHandle stackDataFrameHandle) => throw new NotImplementedException();
17+
TargetPointer GetFrameAddress(IStackDataFrameHandle stackDataFrameHandle) => throw new NotImplementedException();
18+
string GetFrameName(TargetPointer frameIdentifier) => throw new NotImplementedException();
1919
}
2020

2121
public struct StackWalk : IStackWalk

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IStressLog.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public record struct StressMsgData(
3434
public interface IStressLog : IContract
3535
{
3636
static string IContract.Name { get; } = nameof(StressLog);
37-
public virtual bool HasStressLog() => throw new NotImplementedException();
38-
public virtual StressLogData GetStressLogData() => throw new NotImplementedException();
39-
public virtual StressLogData GetStressLogData(TargetPointer stressLog) => throw new NotImplementedException();
40-
public virtual IEnumerable<ThreadStressLogData> GetThreadStressLogs(TargetPointer Logs) => throw new NotImplementedException();
41-
public virtual IEnumerable<StressMsgData> GetStressMessages(ThreadStressLogData threadLog) => throw new NotImplementedException();
42-
public virtual bool IsPointerInStressLog(StressLogData stressLog, TargetPointer pointer) => throw new NotImplementedException();
37+
bool HasStressLog() => throw new NotImplementedException();
38+
StressLogData GetStressLogData() => throw new NotImplementedException();
39+
StressLogData GetStressLogData(TargetPointer stressLog) => throw new NotImplementedException();
40+
IEnumerable<ThreadStressLogData> GetThreadStressLogs(TargetPointer Logs) => throw new NotImplementedException();
41+
IEnumerable<StressMsgData> GetStressMessages(ThreadStressLogData threadLog) => throw new NotImplementedException();
42+
bool IsPointerInStressLog(StressLogData stressLog, TargetPointer pointer) => throw new NotImplementedException();
4343
}
4444

4545
public readonly struct StressLog : IStressLog

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public interface IThread : IContract
4545
{
4646
static string IContract.Name { get; } = nameof(Thread);
4747

48-
public virtual ThreadStoreData GetThreadStoreData() => throw new NotImplementedException();
49-
public virtual ThreadStoreCounts GetThreadCounts() => throw new NotImplementedException();
50-
public virtual ThreadData GetThreadData(TargetPointer thread) => throw new NotImplementedException();
48+
ThreadStoreData GetThreadStoreData() => throw new NotImplementedException();
49+
ThreadStoreCounts GetThreadCounts() => throw new NotImplementedException();
50+
ThreadData GetThreadData(TargetPointer thread) => throw new NotImplementedException();
5151
}
5252

5353
public readonly struct Thread : IThread

0 commit comments

Comments
 (0)