/// <summary>Initializes a new instance of the <see cref="DebugUnionType"/> class.</summary>
        /// <param name="llvmType">Underlying native type this debug type describes</param>
        /// <param name="module">Module to contain the debug metadata for this type</param>
        /// <param name="scope">Scope containing this type</param>
        /// <param name="name">Debug/source name of the type</param>
        /// <param name="file">Source file containing this type</param>
        /// <param name="line">Line number for this type</param>
        /// <param name="debugFlags">Debug flags for this type</param>
        /// <param name="elements">Descriptors for the members of the type</param>
        public DebugUnionType(IStructType llvmType
                              , BitcodeModule module
                              , DIScope scope
                              , string name
                              , DIFile file
                              , uint line
                              , DebugInfoFlags debugFlags
                              , IEnumerable <DebugMemberInfo> elements
                              )
            : base(llvmType)
        {
            llvmType.ValidateNotNull(nameof(llvmType));
            module.ValidateNotNull(nameof(module));
            scope.ValidateNotNull(nameof(scope));
            file.ValidateNotNull(nameof(file));

            if (!llvmType.IsOpaque)
            {
                throw new ArgumentException(Resources.Struct_type_used_as_basis_for_a_union_must_not_have_a_body, nameof(llvmType));
            }

            DIType = module.DIBuilder
                     .CreateReplaceableCompositeType(Tag.UnionType
                                                     , name
                                                     , scope
                                                     , file
                                                     , line
                                                     );
            SetBody(module, scope, file, line, debugFlags, elements);
        }
        /// <summary>Initializes a new instance of the <see cref="DebugUnionType"/> class.</summary>
        /// <param name="module">Module to contain the debug metadata for this type</param>
        /// <param name="nativeName">Native LLVM type name</param>
        /// <param name="scope">Scope containing this type</param>
        /// <param name="name">Debug/source name of the type</param>
        /// <param name="file">Source file containing this type</param>
        /// <param name="line">Line number for this type</param>
        public DebugUnionType(BitcodeModule module
                              , string nativeName
                              , DIScope scope
                              , string name
                              , DIFile file
                              , uint line = 0
                              )
        {
            module.ValidateNotNull(nameof(module));
            file.ValidateNotNull(nameof(file));

            NativeType = module.Context.CreateStructType(nativeName);
            DIType     = module.DIBuilder
                         .CreateReplaceableCompositeType(Tag.UnionType
                                                         , name
                                                         , scope
                                                         , file
                                                         , line
                                                         );
        }