/// local in `bcx.fcx.lllocals`.
/// Adds the created metadata nodes directly to the crate's IR.
pub fn create_local_var_metadata(bcx: Block, local: &ast::Local) {
- if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
+ if bcx.unreachable.get() ||
+ fn_should_be_ignored(bcx.fcx) ||
+ bcx.sess().opts.debuginfo != FullDebugInfo {
return;
}
env_index: uint,
captured_by_ref: bool,
span: Span) {
- if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
+ if bcx.unreachable.get() ||
+ fn_should_be_ignored(bcx.fcx) ||
+ bcx.sess().opts.debuginfo != FullDebugInfo {
return;
}
pub fn create_match_binding_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
variable_ident: ast::Ident,
binding: BindingInfo<'tcx>) {
- if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
+ if bcx.unreachable.get() ||
+ fn_should_be_ignored(bcx.fcx) ||
+ bcx.sess().opts.debuginfo != FullDebugInfo {
return;
}
/// argument in `bcx.fcx.lllocals`.
/// Adds the created metadata nodes directly to the crate's IR.
pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) {
- if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
+ if bcx.unreachable.get() ||
+ fn_should_be_ignored(bcx.fcx) ||
+ bcx.sess().opts.debuginfo != FullDebugInfo {
return;
}
/// loop variable in `bcx.fcx.lllocals`.
/// Adds the created metadata nodes directly to the crate's IR.
pub fn create_for_loop_var_metadata(bcx: Block, pat: &ast::Pat) {
- if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
+ if bcx.unreachable.get() ||
+ fn_should_be_ignored(bcx.fcx) ||
+ bcx.sess().opts.debuginfo != FullDebugInfo {
return;
}
if let Some(code_snippet) = code_snippet {
let bytes = code_snippet.as_bytes();
- if bytes.len() > 0 && &bytes[(bytes.len()-1)..] == b"}" {
+ if bytes.len() > 0 && &bytes[bytes.len()-1..] == b"}" {
cleanup_span = Span {
lo: node_span.hi - codemap::BytePos(1),
hi: node_span.hi,
let mut signature = Vec::with_capacity(fn_decl.inputs.len() + 1);
// Return type -- llvm::DIBuilder wants this at index 0
- match fn_decl.output {
- ast::Return(ref ret_ty) if ret_ty.node == ast::TyTup(vec![]) =>
- signature.push(ptr::null_mut()),
- _ => {
- assert_type_for_node_id(cx, fn_ast_id, error_reporting_span);
-
- let return_type = ty::node_id_to_type(cx.tcx(), fn_ast_id);
- let return_type = monomorphize::apply_param_substs(cx.tcx(),
- param_substs,
- &return_type);
- signature.push(type_metadata(cx, return_type, codemap::DUMMY_SP));
- }
+ assert_type_for_node_id(cx, fn_ast_id, error_reporting_span);
+ let return_type = ty::node_id_to_type(cx.tcx(), fn_ast_id);
+ let return_type = monomorphize::apply_param_substs(cx.tcx(),
+ param_substs,
+ &return_type);
+ if ty::type_is_nil(return_type) {
+ signature.push(ptr::null_mut())
+ } else {
+ signature.push(type_metadata(cx, return_type, codemap::DUMMY_SP));
}
// Arguments types
let work_dir = cx.sess().working_dir.as_str().unwrap();
let file_name =
if full_path.starts_with(work_dir) {
- &full_path[(work_dir.len() + 1u)..full_path.len()]
+ &full_path[work_dir.len() + 1u..full_path.len()]
} else {
full_path
};