Skip to main content

## build_scalable_vector_di_node

# Function build_scalable_vector_di_node

Source

    fn build_scalable_vector_di_node<'ll, 'tcx>(
        cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>,
        unique_type_id: UniqueTypeId<'tcx>,
        name: String,
        adt_def: AdtDef<'tcx>,
        (element_count, element_ty, number_of_vectors): (u16, Ty<'tcx>, NumScalableVectors),
        layout: Layout<'tcx>,
        def_location: Option<(&'ll Metadata, c_uint)>,
        containing_scope: &'ll Metadata,
    ) -> DINodeCreationResult<'ll>

Expand description

Generate debuginfo for a `#[rustc_scalable_vector]` type.

Debuginfo for a scalable vector uses a derived type based on a composite type. The composite type has the `DIFlagVector` flag set and is based on the element type of the scalable vector. The composite type has a subrange from 0 to an expression that calculates the number of elements in the vector.

    !1 = !DIDerivedType(tag: DW_TAG_typedef, name: "svint16_t", ..., baseType: !2, ...)
    !2 = !DICompositeType(tag: DW_TAG_array_type, baseType: !3, ..., flags: DIFlagVector, elements: !4)
    !3 = !DIBasicType(name: "i16", size: 16, encoding: DW_ATE_signed)
    !4 = !{!5}
    !5 = !DISubrange(lowerBound: 0, upperBound: !DIExpression(DW_OP_constu, 4, DW_OP_bregx, 46, 0, DW_OP_mul, DW_OP_constu, 1, DW_OP_minus))

See the `CodegenType::CreateType(const BuiltinType *BT)` implementation in Clang for how this is generated for C and C++.