提交 30375ccb 编写于 作者: M Michael Woerister

debuginfo: Support for by-value arguments (still excluding some cases of self arguments)

上级 b81ea865
......@@ -2103,6 +2103,12 @@ pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
ArgNo: c_uint)
-> ValueRef;
#[fast_ffi]
pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
#[fast_ffi]
pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
pub fn LLVMInitializeX86TargetInfo();
pub fn LLVMInitializeX86Target();
pub fn LLVMInitializeX86TargetMC();
......
......@@ -333,12 +333,18 @@ pub fn create_self_argument_metadata(bcx: @mut Block,
argument_index
};
let variable_access = if unsafe { llvm::LLVMIsAAllocaInst(llptr) } != ptr::null() {
DirectVariable
} else {
IndirectVariable
};
declare_local(bcx,
llptr,
special_idents::self_,
type_of_self,
scope_metadata,
DirectVariable,
variable_access,
ArgumentVariable(argument_index),
span);
}
......@@ -371,6 +377,12 @@ pub fn create_argument_metadata(bcx: @mut Block,
}
};
let variable_access = if unsafe { llvm::LLVMIsAAllocaInst(llptr) } != ptr::null() {
DirectVariable
} else {
IndirectVariable
};
let argument_type = node_id_type(bcx, node_id);
let argument_ident = ast_util::path_to_ident(path_ref);
......@@ -386,7 +398,7 @@ pub fn create_argument_metadata(bcx: @mut Block,
argument_ident,
argument_type,
scope_metadata,
DirectVariable,
variable_access,
ArgumentVariable(argument_index),
span);
}
......
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-Z extra-debug-info
// debugger:break zzz
// debugger:run
// debugger:finish
// debugger:print self
// check:$1 = 1111
// debugger:continue
// debugger:finish
// debugger:print self
// check:$2 = {x = 2222, y = 3333}
// debugger:continue
// debugger:finish
// debugger:print self
// check:$3 = {4444.5, 5555, 6666, 7777.5}
// debugger:continue
// debugger:finish
// debugger:print self->val
// check:$4 = 8888
// debugger:continue
trait Trait {
fn method(self) -> Self;
}
impl Trait for int {
fn method(self) -> int {
zzz();
self
}
}
struct Struct {
x: uint,
y: uint,
}
impl Trait for Struct {
fn method(self) -> Struct {
zzz();
self
}
}
impl Trait for (float, int, int, float) {
fn method(self) -> (float, int, int, float) {
zzz();
self
}
}
impl Trait for @int {
fn method(self) -> @int {
zzz();
self
}
}
fn main() {
let _ = (1111 as int).method();
let _ = Struct { x: 2222, y: 3333 }.method();
let _ = (4444.5, 5555, 6666, 7777.5).method();
let _ = (@8888).method();
}
fn zzz() {()}
......@@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Does not work yet, see issue #8512
// xfail-test
// compile-flags:-Z extra-debug-info
// debugger:break zzz
// debugger:run
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册