1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using System;
6 
7 namespace System.Runtime.CompilerServices
8 {
9     // This attribute should be placed on a static field by the code author to indicate that it is expected to
10     // be completely pre-initialized by the tool chain.  The tool chain will produce an error if the field
11     // cannot be completely pre-initialized.
12     [AttributeUsage(AttributeTargets.Field)]
13     public sealed class PreInitializedAttribute : Attribute
14     {
15     }
16 
17     // Generated by the toolchain.  Associates a given static field with a corresponding RVA static field
18     // containing the pre-initialization data blob.
19     [AttributeUsage(AttributeTargets.Field)]
20     public sealed class InitDataBlobAttribute : Attribute
21     {
InitDataBlobAttribute(Type containerType, string rvaFieldName)22         public InitDataBlobAttribute(Type containerType, string rvaFieldName) { }
23     }
24 
25     // Generated by the toolchain.  Placed on the toolchain-generated RVA/proxy static field.  Represents a fixup
26     // to a method address.  Obviously, overloaded methods are ambiguous with this set of parameters.
27     [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
28     public sealed class MethodAddrFixupAttribute : Attribute
29     {
MethodAddrFixupAttribute(int offset, Type containerType, string methodName)30         public MethodAddrFixupAttribute(int offset, Type containerType, string methodName) { }
31     }
32 
33     // Generated by the toolchain.  Placed on the toolchain-generated RVA/proxy static field.  Represents a fixup
34     // to the address of a static field.
35     [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
36     public sealed class FieldAddrFixupAttribute : Attribute
37     {
FieldAddrFixupAttribute(int offset, Type containerType, string fieldName)38         public FieldAddrFixupAttribute(int offset, Type containerType, string fieldName) { }
39     }
40 
41     // Generated by the toolchain.  Placed on the toolchain-generated RVA/proxy static field.  Represents a fixup
42     // to a type handle (e.g. typeof(foo).TypeHandle).
43     [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
44     public sealed class TypeHandleFixupAttribute : Attribute
45     {
TypeHandleFixupAttribute(int offset, Type type)46         public TypeHandleFixupAttribute(int offset, Type type) { }
TypeHandleFixupAttribute(int offset, string typeName)47         public TypeHandleFixupAttribute(int offset, string typeName) { }
48     }
49 
50     // Generated by the toolchain.  Placed on the toolchain-generated proxy static field.  Represents the initialization
51     // of a non-array-typed static field.
52     [AttributeUsage(AttributeTargets.Field)]
53     public sealed class NonArrayAttribute : Attribute
54     {
NonArrayAttribute()55         public NonArrayAttribute() { }
56     }
57 
58     // Generated by the toolchain.  Placed on the toolchain-generated proxy static field.  Represents the element
59     // type of the static array-typed field being initialized.
60     [AttributeUsage(AttributeTargets.Field)]
61     public sealed class ElemTypeAttribute : Attribute
62     {
ElemTypeAttribute(Type elemType)63         public ElemTypeAttribute(Type elemType) { }
64     }
65 }
66