/// <summary> /// Initializes data based on the <see cref="ModifierRecord"/>. /// </summary> private void Initialize(ModifierRecord record) { PdbSymbol symbol = PdbModule.GetSymbol(record.ModifiedType); symbol.LinkSymbols(this); Tag = symbol.Tag; BasicType = symbol.BasicType; Offset = symbol.Offset; Size = symbol.Size; IsVirtualInheritance = symbol.IsVirtualInheritance; IsForwardReference = symbol.IsForwardReference; UniqueName = symbol.UniqueName; Name = symbol.Name; if ((record.Modifiers & ModifierOptions.Unaligned) != ModifierOptions.None) { Name = "unaligned " + Name; } if ((record.Modifiers & ModifierOptions.Volatile) != ModifierOptions.None) { Name = "volatile " + Name; } if ((record.Modifiers & ModifierOptions.Const) != ModifierOptions.None) { Name = "const " + Name; } }
/// <summary> /// Initializes data based on the <see cref="VirtualBaseClassRecord"/>. /// </summary> private void Initialize(VirtualBaseClassRecord record) { Symbol symbol = PdbModule.GetSymbol(record.BaseType); Tag = Engine.CodeTypeTag.BaseClass; BasicType = symbol.BasicType; Name = symbol.Name; Size = symbol.Size; IsVirtualInheritance = true; }
/// <summary> /// Initializes data based on the <see cref="BaseClassRecord"/>. /// </summary> private void Initialize(BaseClassRecord record) { Symbol symbol = PdbModule.GetSymbol(record.Type); Offset = (int)record.Offset; Tag = Engine.CodeTypeTag.BaseClass; BasicType = symbol.BasicType; Name = symbol.Name; Size = symbol.Size; IsVirtualInheritance = false; }
/// <summary> /// Gets the element type (if symbol is array or pointer). /// </summary> protected override Symbol GetElementType() { if (typeRecord is ArrayRecord arrayRecord) { return(PdbModule.GetSymbol(arrayRecord.ElementType)); } if (typeRecord is PointerRecord pointerRecord) { return(PdbModule.GetSymbol(pointerRecord.ReferentType)); } return(null); }
/// <summary> /// Gets user type base classes. /// </summary> protected override IEnumerable <Symbol> GetBaseClasses() { if (typeRecord is ClassRecord classRecord) { if (classRecord.DerivationList != TypeIndex.None) { TypeRecord baseClasses = PdbModule.PdbFile.TpiStream[classRecord.DerivationList]; throw new NotImplementedException(); } else if (classRecord.FieldList != TypeIndex.None) { foreach (TypeRecord field in EnumerateFieldList(classRecord.FieldList)) { if (field is BaseClassRecord || field is VirtualBaseClassRecord) { yield return(PdbModule.GetSymbol(field)); } } } } }
/// <summary> /// Initializes data based on the simple built-in type. /// </summary> private void Initialize(TypeIndex typeIndex) { Name = typeIndex.SimpleTypeName; Tag = typeIndex.SimpleMode != SimpleTypeMode.Direct ? Engine.CodeTypeTag.Pointer : Engine.CodeTypeTag.BuiltinType; switch (typeIndex.SimpleKind) { case SimpleTypeKind.None: BasicType = DIA.BasicType.NoType; Size = 0; break; case SimpleTypeKind.Void: BasicType = DIA.BasicType.Void; Size = 0; break; case SimpleTypeKind.HResult: BasicType = DIA.BasicType.Hresult; Size = 4; break; case SimpleTypeKind.UnsignedCharacter: BasicType = DIA.BasicType.UInt; Size = 1; break; case SimpleTypeKind.NarrowCharacter: case SimpleTypeKind.SignedCharacter: BasicType = DIA.BasicType.Char; Size = 1; break; case SimpleTypeKind.WideCharacter: BasicType = DIA.BasicType.WChar; Size = 2; break; case SimpleTypeKind.Character16: BasicType = DIA.BasicType.Char16; Size = 2; break; case SimpleTypeKind.Character32: BasicType = DIA.BasicType.Char32; Size = 4; break; case SimpleTypeKind.SByte: BasicType = DIA.BasicType.Int; Size = 1; break; case SimpleTypeKind.Byte: BasicType = DIA.BasicType.UInt; Size = 1; break; case SimpleTypeKind.Int16Short: case SimpleTypeKind.Int16: BasicType = DIA.BasicType.Int; Size = 2; break; case SimpleTypeKind.UInt16: case SimpleTypeKind.UInt16Short: BasicType = DIA.BasicType.UInt; Size = 2; break; case SimpleTypeKind.Int32Long: case SimpleTypeKind.Int32: BasicType = DIA.BasicType.Int; Size = 4; break; case SimpleTypeKind.UInt32Long: case SimpleTypeKind.UInt32: BasicType = DIA.BasicType.UInt; Size = 4; break; case SimpleTypeKind.Int64Quad: case SimpleTypeKind.Int64: BasicType = DIA.BasicType.Long; Size = 8; break; case SimpleTypeKind.UInt64Quad: case SimpleTypeKind.UInt64: BasicType = DIA.BasicType.ULong; Size = 8; break; case SimpleTypeKind.Int128Oct: case SimpleTypeKind.Int128: BasicType = DIA.BasicType.Long; Size = 16; break; case SimpleTypeKind.UInt128Oct: case SimpleTypeKind.UInt128: BasicType = DIA.BasicType.ULong; Size = 16; break; case SimpleTypeKind.Float16: BasicType = DIA.BasicType.Float; Size = 2; break; case SimpleTypeKind.Float32: case SimpleTypeKind.Float32PartialPrecision: BasicType = DIA.BasicType.Float; Size = 4; break; case SimpleTypeKind.Float48: BasicType = DIA.BasicType.Float; Size = 6; break; case SimpleTypeKind.Float64: BasicType = DIA.BasicType.Float; Size = 8; break; case SimpleTypeKind.Float80: BasicType = DIA.BasicType.Float; Size = 10; break; case SimpleTypeKind.Float128: BasicType = DIA.BasicType.Float; Size = 12; break; case SimpleTypeKind.Complex16: BasicType = DIA.BasicType.Complex; Size = 2; break; case SimpleTypeKind.Complex32: case SimpleTypeKind.Complex32PartialPrecision: BasicType = DIA.BasicType.Complex; Size = 4; break; case SimpleTypeKind.Complex48: BasicType = DIA.BasicType.Complex; Size = 6; break; case SimpleTypeKind.Complex64: BasicType = DIA.BasicType.Complex; Size = 8; break; case SimpleTypeKind.Complex80: BasicType = DIA.BasicType.Complex; Size = 10; break; case SimpleTypeKind.Complex128: BasicType = DIA.BasicType.Complex; Size = 16; break; case SimpleTypeKind.Boolean8: BasicType = DIA.BasicType.Bool; Size = 1; break; case SimpleTypeKind.Boolean16: BasicType = DIA.BasicType.Bool; Size = 2; break; case SimpleTypeKind.Boolean32: BasicType = DIA.BasicType.Bool; Size = 4; break; case SimpleTypeKind.Boolean64: BasicType = DIA.BasicType.Bool; Size = 8; break; case SimpleTypeKind.Boolean128: BasicType = DIA.BasicType.Bool; Size = 16; break; case SimpleTypeKind.NotTranslated: BasicType = DIA.BasicType.NoType; Size = 0; break; default: throw new NotImplementedException($"Unexpected simple type: {typeIndex.SimpleKind}, from type index: {typeIndex}"); } if (typeIndex.SimpleMode != SimpleTypeMode.Direct) { ElementType = PdbModule.GetSymbol(new TypeIndex(typeIndex.SimpleKind)); ElementType.PointerType = this; } }