]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_llvm/debuginfo/gdb.rs
Use the method form for CodegenCx everywhere
[rust.git] / src / librustc_codegen_llvm / debuginfo / gdb.rs
index f6faddb894ffdf41c532659fffc92afea806f412..78958080a3b467efb83bd053e6ba4491c9ff1337 100644 (file)
 
 use llvm;
 
-use common::{C_bytes, CodegenCx, C_i32};
+use common::CodegenCx;
 use builder::Builder;
 use declare;
 use rustc::session::config::DebugInfo;
 use type_::Type;
 use value::Value;
+use interfaces::{BuilderMethods, CommonMethods};
 
 use syntax::attr;
 
 /// Inserts a side-effect free instruction sequence that makes sure that the
 /// .debug_gdb_scripts global is referenced, so it isn't removed by the linker.
 pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &Builder) {
-    if needs_gdb_debug_scripts_section(bx.cx) {
-        let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx.cx);
+    if needs_gdb_debug_scripts_section(bx.cx()) {
+        let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx.cx());
         // Load just the first byte as that's all that's necessary to force
         // LLVM to keep around the reference to the global.
-        let indices = [C_i32(bx.cx, 0), C_i32(bx.cx, 0)];
+        let indices = [bx.cx().c_i32(0), bx.cx().c_i32(0)];
         let element = bx.inbounds_gep(gdb_debug_scripts_section, &indices);
         let volative_load_instruction = bx.volatile_load(element);
         unsafe {
@@ -63,7 +64,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(cx: &CodegenCx<'ll, '_>)
                 bug!("symbol `{}` is already defined", section_var_name)
             });
             llvm::LLVMSetSection(section_var, section_name.as_ptr() as *const _);
-            llvm::LLVMSetInitializer(section_var, C_bytes(cx, section_contents));
+            llvm::LLVMSetInitializer(section_var, cx.c_bytes(section_contents));
             llvm::LLVMSetGlobalConstant(section_var, llvm::True);
             llvm::LLVMSetUnnamedAddr(section_var, llvm::True);
             llvm::LLVMRustSetLinkage(section_var, llvm::Linkage::LinkOnceODRLinkage);