From 978ec0f0a1d802bc757c53f2c5ceb88e16f5042b Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Fri, 25 Oct 2019 16:19:34 -0300 Subject: [PATCH] Added model for layout information --- Model/Types/TypeDefinitions.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Model/Types/TypeDefinitions.cs b/Model/Types/TypeDefinitions.cs index 27062ea7..6a2d1bde 100644 --- a/Model/Types/TypeDefinitions.cs +++ b/Model/Types/TypeDefinitions.cs @@ -605,7 +605,25 @@ public enum VisibilityKind Internal = 4, Public = 8 } - + public enum LayoutKind + { + Unknown, + AutoLayout, // Class fields are auto-laid out + SequentialLayout, // Class fields are laid out sequentially + ExplicitLayout, // Layout is supplied explicitly + } + public class LayoutInformation + { + public LayoutKind Kind { get; set; } + public short PackingSize { get; set; } + public int ClassSize { get; set; } + public LayoutInformation(LayoutKind kind = LayoutKind.Unknown) + { + Kind = kind; + PackingSize = -1; + ClassSize = -1; + } + } public class TypeDefinition : IBasicType, IGenericDefinition, ITypeMemberDefinition, ITypeDefinitionContainer { public TypeKind TypeKind { get; set; } @@ -623,7 +641,7 @@ public class TypeDefinition : IBasicType, IGenericDefinition, ITypeMemberDefinit public IList Methods { get; private set; } public IList Types { get; private set; } public IBasicType UnderlayingType { get; set; } - + public LayoutInformation LayoutInformation { get; set; } public TypeDefinition(string name, TypeKind typeKind = TypeKind.Unknown, TypeDefinitionKind kind = TypeDefinitionKind.Unknown) { this.Name = name; @@ -635,6 +653,7 @@ public TypeDefinition(string name, TypeKind typeKind = TypeKind.Unknown, TypeDef this.Fields = new List(); this.Methods = new List(); this.Types = new List(); + this.LayoutInformation = new LayoutInformation(); } public string GenericName