Replaced Codegen field access by trait method

This commit is contained in:
Denis Merigoux 2018-08-28 17:50:57 +02:00 committed by Eduard-Mihai Burtescu
parent 8714e6bce6
commit d325844804
16 changed files with 247 additions and 247 deletions

View file

@ -26,11 +26,11 @@ 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 = [CodegenCx::c_i32(bx.cx, 0), CodegenCx::c_i32(bx.cx, 0)];
let indices = [CodegenCx::c_i32(bx.cx(), 0), CodegenCx::c_i32(bx.cx(), 0)];
let element = bx.inbounds_gep(gdb_debug_scripts_section, &indices);
let volative_load_instruction = bx.volatile_load(element);
unsafe {

View file

@ -494,7 +494,7 @@ pub fn declare_local(
span: Span,
) {
assert!(!dbg_context.get_ref(span).source_locations_enabled.get());
let cx = bx.cx;
let cx = bx.cx();
let file = span_start(cx, span).file;
let file_metadata = file_metadata(cx,

View file

@ -42,7 +42,7 @@ pub fn set_source_location(
let dbg_loc = if function_debug_context.source_locations_enabled.get() {
debug!("set_source_location: {}", bx.sess().source_map().span_to_string(span));
let loc = span_start(bx.cx, span);
let loc = span_start(bx.cx(), span);
InternalDebugLocation::new(scope.unwrap(), loc.line, loc.col.to_usize())
} else {
UnknownLocation
@ -88,7 +88,7 @@ pub fn set_debug_location(
// For MSVC, set the column number to zero.
// Otherwise, emit it. This mimics clang behaviour.
// See discussion in https://github.com/rust-lang/rust/issues/42921
let col_used = if bx.cx.sess().target.target.options.is_like_msvc {
let col_used = if bx.cx().sess().target.target.options.is_like_msvc {
UNKNOWN_COLUMN_NUMBER
} else {
col as c_uint
@ -97,7 +97,7 @@ pub fn set_debug_location(
unsafe {
Some(llvm::LLVMRustDIBuilderCreateDebugLocation(
debug_context(bx.cx).llcontext,
debug_context(bx.cx()).llcontext,
line as c_uint,
col_used,
scope,