pub fn create_vtable_metadata(
    cx: &CodegenCx<'ll, 'tcx>,
    ty: ty::Ty<'tcx>,
    vtable: &'ll Value,
) {
    if cx.dbg_cx.is_none() {
        return;
    }

    let type_metadata = type_metadata(cx, ty, syntax_pos::DUMMY_SP);

    unsafe {
        // LLVMRustDIBuilderCreateStructType() wants an empty array. A null
        // pointer will lead to hard to trace and debug LLVM assertions
        // later on in llvm/lib/IR/Value.cpp.
        let empty_array = create_DIArray(DIB(cx), &[]);

        let name = const_cstr!("vtable");

        // Create a new one each time.  We don't want metadata caching
        // here, because each vtable will refer to a unique containing
        // type.
        let vtable_type = llvm::LLVMRustDIBuilderCreateStructType(
            DIB(cx),
            NO_SCOPE_METADATA,
            name.as_ptr(),
            unknown_file_metadata(cx),
            UNKNOWN_LINE_NUMBER,
            Size::ZERO.bits(),
            cx.tcx.data_layout.pointer_align.abi_bits() as u32,
            DIFlags::FlagArtificial,
            None,
            empty_array,
            0,
            Some(type_metadata),
            name.as_ptr()
        );

        llvm::LLVMRustDIBuilderCreateStaticVariable(DIB(cx),
                                                    NO_SCOPE_METADATA,
                                                    name.as_ptr(),
                                                    // LLVM 3.9
                                                    // doesn't accept
                                                    // null here, so
                                                    // pass the name
                                                    // as the linkage
                                                    // name.
                                                    name.as_ptr(),
                                                    unknown_file_metadata(cx),
                                                    UNKNOWN_LINE_NUMBER,
                                                    vtable_type,
                                                    true,
                                                    vtable,
                                                    None,
                                                    0);
    }
}
/// Creates debug information for the given vtable, which is for the
/// given type.
///
/// Adds the created metadata nodes directly to the crate's IR.
Creates debug information for the given vtable, which is for the
given type.

Adds the created metadata nodes directly to the crate's IR.
Creates debug information for the given vtable which is for the given type . Adds the created metadata nodes directly to the crate ' s IR .
pub fn create_vtable_metadata(
    cx: &CodegenCx<'ll, 'tcx>,
    ty: ty::Ty<'tcx>,
    vtable: &'ll Value,
) {
    if cx.dbg_cx.is_none() {
        return;
    }
    let type_metadata = type_metadata(cx, ty, syntax_pos::DUMMY_SP);
    unsafe {
        // LLVMRustDIBuilderCreateStructType() wants an empty array. A null
        // pointer will lead to hard to trace and debug LLVM assertions
        // later on in llvm/lib/IR/Value.cpp.
        let empty_array = create_DIArray(DIB(cx), &[]);
        let name = const_cstr!("vtable");
        // Create a new one each time.  We don't want metadata caching
        // here, because each vtable will refer to a unique containing
        // type.
        let vtable_type = llvm::LLVMRustDIBuilderCreateStructType(
            DIB(cx),
            NO_SCOPE_METADATA,
            name.as_ptr(),
            unknown_file_metadata(cx),
            UNKNOWN_LINE_NUMBER,
            Size::ZERO.bits(),
            cx.tcx.data_layout.pointer_align.abi_bits() as u32,
            DIFlags::FlagArtificial,
            None,
            empty_array,
            0,
            Some(type_metadata),
            name.as_ptr()
        );
        llvm::LLVMRustDIBuilderCreateStaticVariable(DIB(cx),
                                                    NO_SCOPE_METADATA,
                                                    name.as_ptr(),
                                                    // LLVM 3.9
                                                    // doesn't accept
                                                    // null here, so
                                                    // pass the name
                                                    // as the linkage
                                                    // name.
                                                    name.as_ptr(),
                                                    unknown_file_metadata(cx),
                                                    UNKNOWN_LINE_NUMBER,
                                                    vtable_type,
                                                    true,
                                                    vtable,
                                                    None,
                                                    0);
    }
}
pub fn create_vtable_metadata ( cx : & CodegenCx < ' ll , ' tcx > , ty : ty :: Ty < ' tcx > , vtable : & ' ll Value , ) { if cx . dbg_cx . is_none ( ) { return ; } let type_metadata = type_metadata ( cx , ty , syntax_pos :: DUMMY_SP ) ; unsafe { // LLVMRustDIBuilderCreateStructType() wants an empty array. A null // pointer will lead to hard to trace and debug LLVM assertions // later on in llvm/lib/IR/Value.cpp. let empty_array = create_DIArray ( DIB ( cx ) , & [ ] ) ; let name = const_cstr ! ( " " ) ; // Create a new one each time.  We don't want metadata caching // here, because each vtable will refer to a unique containing // type. let vtable_type = llvm :: LLVMRustDIBuilderCreateStructType ( DIB ( cx ) , NO_SCOPE_METADATA , name . as_ptr ( ) , unknown_file_metadata ( cx ) , UNKNOWN_LINE_NUMBER , Size :: ZERO . bits ( ) , cx . tcx . data_layout . pointer_align . abi_bits ( ) as u32 , DIFlags :: FlagArtificial , None , empty_array , 0 , Some ( type_metadata ) , name . as_ptr ( ) ) ; llvm :: LLVMRustDIBuilderCreateStaticVariable ( DIB ( cx ) , NO_SCOPE_METADATA , name . as_ptr ( ) , // LLVM 3.9 // doesn't accept // null here, so // pass the name // as the linkage // name. name . as_ptr ( ) , unknown_file_metadata ( cx ) , UNKNOWN_LINE_NUMBER , vtable_type , true , vtable , None , 0 ) ; } }
Creates debug information for the given vtable, which is for the
given type.
Creates debug information for the given vtable which is for the given type .
cx
&CodegenCx<'ll, 'tcx>
ty
ty::Ty<'tcx>
vtable
&'ll Value
cx
&CodegenCx<'ll, 'tcx>
ty
ty::Ty<'tcx>
vtable
&'ll Value