pub fn finalize(cx: &CodegenCx) {
    if cx.dbg_cx.is_none() {
        return;
    }

    debug!("finalize");

    if gdb::needs_gdb_debug_scripts_section(cx) {
        // Add a .debug_gdb_scripts section to this compile-unit. This will
        // cause GDB to try and load the gdb_load_rust_pretty_printers.py file,
        // which activates the Rust pretty printers for binary this section is
        // contained in.
        gdb::get_or_insert_gdb_debug_scripts_section_global(cx);
    }

    unsafe {
        llvm::LLVMRustDIBuilderFinalize(DIB(cx));
        // Debuginfo generation in LLVM by default uses a higher
        // version of dwarf than macOS currently understands. We can
        // instruct LLVM to emit an older version of dwarf, however,
        // for macOS to understand. For more info see #11352
        // This can be overridden using --llvm-opts -dwarf-version,N.
        // Android has the same issue (#22398)
        if cx.sess().target.target.options.is_like_osx ||
           cx.sess().target.target.options.is_like_android {
            llvm::LLVMRustAddModuleFlag(cx.llmod,
                                        "Dwarf Version\0".as_ptr() as *const _,
                                        2)
        }

        // Indicate that we want CodeView debug information on MSVC
        if cx.sess().target.target.options.is_like_msvc {
            llvm::LLVMRustAddModuleFlag(cx.llmod,
                                        "CodeView\0".as_ptr() as *const _,
                                        1)
        }

        // Prevent bitcode readers from deleting the debug info.
        let ptr = "Debug Info Version\0".as_ptr();
        llvm::LLVMRustAddModuleFlag(cx.llmod, ptr as *const _,
                                    llvm::LLVMRustDebugMetadataVersion());
    };
}
/// Create any deferred debug metadata nodes
Create any deferred debug metadata nodes
Create any deferred debug metadata nodes
pub fn finalize(cx: &CodegenCx) {
    if cx.dbg_cx.is_none() {
        return;
    }
    debug!("finalize");
    if gdb::needs_gdb_debug_scripts_section(cx) {
        // Add a .debug_gdb_scripts section to this compile-unit. This will
        // cause GDB to try and load the gdb_load_rust_pretty_printers.py file,
        // which activates the Rust pretty printers for binary this section is
        // contained in.
        gdb::get_or_insert_gdb_debug_scripts_section_global(cx);
    }
    unsafe {
        llvm::LLVMRustDIBuilderFinalize(DIB(cx));
        // Debuginfo generation in LLVM by default uses a higher
        // version of dwarf than macOS currently understands. We can
        // instruct LLVM to emit an older version of dwarf, however,
        // for macOS to understand. For more info see #11352
        // This can be overridden using --llvm-opts -dwarf-version,N.
        // Android has the same issue (#22398)
        if cx.sess().target.target.options.is_like_osx ||
           cx.sess().target.target.options.is_like_android {
            llvm::LLVMRustAddModuleFlag(cx.llmod,
                                        "Dwarf Version\0".as_ptr() as *const _,
                                        2)
        }
        // Indicate that we want CodeView debug information on MSVC
        if cx.sess().target.target.options.is_like_msvc {
            llvm::LLVMRustAddModuleFlag(cx.llmod,
                                        "CodeView\0".as_ptr() as *const _,
                                        1)
        }
        // Prevent bitcode readers from deleting the debug info.
        let ptr = "Debug Info Version\0".as_ptr();
        llvm::LLVMRustAddModuleFlag(cx.llmod, ptr as *const _,
                                    llvm::LLVMRustDebugMetadataVersion());
    };
}
pub fn finalize ( cx : & CodegenCx ) { if cx . dbg_cx . is_none ( ) { return ; } debug ! ( " " ) ; if gdb :: needs_gdb_debug_scripts_section ( cx ) { // Add a .debug_gdb_scripts section to this compile-unit. This will // cause GDB to try and load the gdb_load_rust_pretty_printers.py file, // which activates the Rust pretty printers for binary this section is // contained in. gdb :: get_or_insert_gdb_debug_scripts_section_global ( cx ) ; } unsafe { llvm :: LLVMRustDIBuilderFinalize ( DIB ( cx ) ) ; // Debuginfo generation in LLVM by default uses a higher // version of dwarf than macOS currently understands. We can // instruct LLVM to emit an older version of dwarf, however, // for macOS to understand. For more info see #11352 // This can be overridden using --llvm-opts -dwarf-version,N. // Android has the same issue (#22398) if cx . sess ( ) . target . target . options . is_like_osx || cx . sess ( ) . target . target . options . is_like_android { llvm :: LLVMRustAddModuleFlag ( cx . llmod , " \0 " . as_ptr ( ) as * const _ , 2 ) } // Indicate that we want CodeView debug information on MSVC if cx . sess ( ) . target . target . options . is_like_msvc { llvm :: LLVMRustAddModuleFlag ( cx . llmod , " \0 " . as_ptr ( ) as * const _ , 1 ) } // Prevent bitcode readers from deleting the debug info. let ptr = " \0 " . as_ptr ( ) ; llvm :: LLVMRustAddModuleFlag ( cx . llmod , ptr as * const _ , llvm :: LLVMRustDebugMetadataVersion ( ) ) ; } ; }
Create any deferred debug metadata nodes
Create any deferred debug metadata nodes
cx
&CodegenCx
cx
&CodegenCx