From 9557707d915b6c9ed497fd9b2885bafeb4d6fddc Mon Sep 17 00:00:00 2001 From: Michal Strehovsky Date: Wed, 24 May 2017 15:09:13 -0700 Subject: Extend metadata schema with module metadata This is to support NetStandard APIs that are useful for CoreFX test bringup and general compat. [tfs-changeset: 1659572] --- .../NativeFormat/Writer/NativeFormatWriterGen.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/ILCompiler.MetadataWriter') diff --git a/src/ILCompiler.MetadataWriter/src/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs b/src/ILCompiler.MetadataWriter/src/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs index 80d84db3a..a1c8e11c7 100644 --- a/src/ILCompiler.MetadataWriter/src/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs +++ b/src/ILCompiler.MetadataWriter/src/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs @@ -4360,6 +4360,8 @@ namespace Internal.Metadata.NativeFormat.Writer EntryPoint = visitor.Visit(this, EntryPoint); GlobalModuleType = visitor.Visit(this, GlobalModuleType); CustomAttributes = visitor.Visit(this, CustomAttributes); + ModuleName = visitor.Visit(this, ModuleName); + ModuleCustomAttributes = visitor.Visit(this, ModuleCustomAttributes); } // Visit public override sealed bool Equals(Object obj) @@ -4376,6 +4378,8 @@ namespace Internal.Metadata.NativeFormat.Writer if (RevisionNumber != other.RevisionNumber) return false; if (!PublicKey.SequenceEqual(other.PublicKey)) return false; if (!Object.Equals(Culture, other.Culture)) return false; + if (!Object.Equals(ModuleName, other.ModuleName)) return false; + if (!Mvid.SequenceEqual(other.Mvid)) return false; return true; } // Equals @@ -4400,6 +4404,14 @@ namespace Internal.Metadata.NativeFormat.Writer } } hash = ((hash << 13) - (hash >> 19)) ^ (Culture == null ? 0 : Culture.GetHashCode()); + hash = ((hash << 13) - (hash >> 19)) ^ (ModuleName == null ? 0 : ModuleName.GetHashCode()); + if (Mvid != null) + { + for (int i = 0; i < Mvid.Length; i++) + { + hash = ((hash << 13) - (hash >> 19)) ^ Mvid[i].GetHashCode(); + } + } LeaveGetHashCode(); _hash = hash; return _hash; @@ -4420,6 +4432,9 @@ namespace Internal.Metadata.NativeFormat.Writer writer.Write(EntryPoint); writer.Write(GlobalModuleType); writer.Write(CustomAttributes); + writer.Write(ModuleName); + writer.Write(Mvid); + writer.Write(ModuleCustomAttributes); } // Save internal static ScopeDefinitionHandle AsHandle(ScopeDefinition record) @@ -4455,6 +4470,9 @@ namespace Internal.Metadata.NativeFormat.Writer public QualifiedMethod EntryPoint; public TypeDefinition GlobalModuleType; public List CustomAttributes = new List(); + public ConstantStringValue ModuleName; + public Byte[] Mvid; + public List ModuleCustomAttributes = new List(); } // ScopeDefinition public partial class ScopeReference : MetadataRecord -- cgit v1.2.3