private static DICompositeType BuildDebugType([ValidatedNotNull] IArrayType llvmType , [ValidatedNotNull] IDebugType <ITypeRef, DIType> elementType , [ValidatedNotNull] BitcodeModule module , uint count , uint lowerBound , uint alignment ) { llvmType.ValidateNotNull(nameof(llvmType)); elementType.ValidateNotNull(nameof(elementType)); module.ValidateNotNull(nameof(module)); if (llvmType.ElementType.GetTypeRef( ) != elementType.GetTypeRef( )) { throw new ArgumentException(Resources.ElementType_doesn_t_match_array_element_type); } if (llvmType.IsSized) { return(module.DIBuilder.CreateArrayType(module.Layout.BitSizeOf(llvmType) , alignment , elementType.DIType ! // validated not null in constructor , module.DIBuilder.CreateSubRange(lowerBound, count) )); } return(module.DIBuilder.CreateReplaceableCompositeType(Tag.ArrayType , string.Empty , module.DICompileUnit ?? default , default
/// <summary>Initializes a new instance of the <see cref="DebugArrayType"/> class</summary> /// <param name="llvmType">Underlying LLVM array type to bind debug info to</param> /// <param name="elementType">Array element type with debug information</param> /// <param name="module">module to use for creating debug information</param> /// <param name="count">Number of elements in the array</param> /// <param name="lowerBound">Lower bound of the array [default = 0]</param> /// <param name="alignment">Alignment for the type</param> public DebugArrayType(IArrayType llvmType , IDebugType <ITypeRef, DIType> elementType , BitcodeModule module , uint count , uint lowerBound = 0 , uint alignment = 0 ) : base(llvmType) { llvmType.ValidateNotNull(nameof(llvmType)); elementType.ValidateNotNull(nameof(elementType)); if (llvmType.ElementType.GetTypeRef() != elementType.GetTypeRef()) { throw new ArgumentException("elementType doesn't match array element type"); } DIType = CreateDebugInfoForArray(llvmType, elementType, module, count, lowerBound, alignment); DebugElementType = elementType; }