// A convenience wrapper around LLVMDIBuilderCreateStructType(). Does not do any
// caching, does not add any fields to the struct. This can be done later with
// set_members_of_composite_type().
A convenience wrapper around LLVMDIBuilderCreateStructType(). Does not do any
caching, does not add any fields to the struct. This can be done later with
set_members_of_composite_type().
A convenience wrapper around LLVMDIBuilderCreateStructType () . Does not do any caching does not add any fields to the struct . This can be done later with set_members_of_composite_type () .
fn create_struct_stub(cx: &CrateContext,
                      struct_llvm_type: Type,
                      struct_type_name: &str,
                      unique_type_id: UniqueTypeId,
                      containing_scope: DIScope)
                   -> DICompositeType {
    let (struct_size, struct_align) = size_and_align_of(cx, struct_llvm_type);
    let unique_type_id_str = debug_context(cx).type_map
                                              .borrow()
                                              .get_unique_type_id_as_string(unique_type_id);
    let name = CString::new(struct_type_name).unwrap();
    let unique_type_id = CString::new(unique_type_id_str.as_bytes()).unwrap();
    let metadata_stub = unsafe {
        // LLVMDIBuilderCreateStructType() 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), &[]);
        llvm::LLVMDIBuilderCreateStructType(
            DIB(cx),
            containing_scope,
            name.as_ptr(),
            NO_FILE_METADATA,
            UNKNOWN_LINE_NUMBER,
            bytes_to_bits(struct_size),
            bytes_to_bits(struct_align),
            0,
            ptr::null_mut(),
            empty_array,
            0,
            ptr::null_mut(),
            unique_type_id.as_ptr())
    };
    return metadata_stub;
}
fn create_struct_stub ( cx : & CrateContext , struct_llvm_type : Type , struct_type_name : & str , unique_type_id : UniqueTypeId , containing_scope : DIScope ) -> DICompositeType { let ( struct_size , struct_align ) = size_and_align_of ( cx , struct_llvm_type ) ; let unique_type_id_str = debug_context ( cx ) . type_map . borrow ( ) . get_unique_type_id_as_string ( unique_type_id ) ; let name = CString :: new ( struct_type_name ) . unwrap ( ) ; let unique_type_id = CString :: new ( unique_type_id_str . as_bytes ( ) ) . unwrap ( ) ; let metadata_stub = unsafe { // LLVMDIBuilderCreateStructType() 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 ) , & [ ] ) ; llvm :: LLVMDIBuilderCreateStructType ( DIB ( cx ) , containing_scope , name . as_ptr ( ) , NO_FILE_METADATA , UNKNOWN_LINE_NUMBER , bytes_to_bits ( struct_size ) , bytes_to_bits ( struct_align ) , 0 , ptr :: null_mut ( ) , empty_array , 0 , ptr :: null_mut ( ) , unique_type_id . as_ptr ( ) ) } ; return metadata_stub ; }
A convenience wrapper around LLVMDIBuilderCreateStructType().
A convenience wrapper around LLVMDIBuilderCreateStructType () .
cx
&CrateContext
struct_llvm_type
Type
struct_type_name
&str
unique_type_id
UniqueTypeId
containing_scope
DIScope