Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
61a0a7f0
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
61a0a7f0
编写于
11月 27, 2014
作者:
M
Michael Woerister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debuginfo: Fix multi-byte character related bug in cleanup scope handling.
Also see issue #18791.
上级
de95ad4c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
62 addition
and
18 deletion
+62
-18
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/base.rs
+1
-1
src/librustc_trans/trans/controlflow.rs
src/librustc_trans/trans/controlflow.rs
+2
-2
src/librustc_trans/trans/debuginfo.rs
src/librustc_trans/trans/debuginfo.rs
+23
-12
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/expr.rs
+8
-3
src/test/debuginfo/multi-byte-chars.rs
src/test/debuginfo/multi-byte-chars.rs
+28
-0
未找到文件。
src/librustc_trans/trans/base.rs
浏览文件 @
61a0a7f0
...
...
@@ -1816,7 +1816,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
// cleanup scope for the incoming arguments
let
fn_cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
fn_ast_id
,
body
.span
,
true
);
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
ccx
,
fn_ast_id
,
body
.span
,
true
);
let
arg_scope
=
fcx
.push_custom_cleanup_scope_with_debug_loc
(
fn_cleanup_debug_loc
);
let
block_ty
=
node_id_type
(
bcx
,
body
.id
);
...
...
src/librustc_trans/trans/controlflow.rs
浏览文件 @
61a0a7f0
...
...
@@ -55,7 +55,7 @@ pub fn trans_stmt<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
let
id
=
ast_util
::
stmt_id
(
s
);
let
cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
id
,
s
.span
,
false
);
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
bcx
.ccx
(),
id
,
s
.span
,
false
);
fcx
.push_ast_cleanup_scope
(
cleanup_debug_loc
);
match
s
.node
{
...
...
@@ -103,7 +103,7 @@ pub fn trans_block<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
let
mut
bcx
=
bcx
;
let
cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
b
.id
,
b
.span
,
true
);
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
b
cx
.ccx
(),
b
.id
,
b
.span
,
true
);
fcx
.push_ast_cleanup_scope
(
cleanup_debug_loc
);
for
s
in
b
.stmts
.iter
()
{
...
...
src/librustc_trans/trans/debuginfo.rs
浏览文件 @
61a0a7f0
...
...
@@ -1047,10 +1047,11 @@ pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) {
})
}
pub
fn
get_cleanup_debug_loc_for_ast_node
(
node_id
:
ast
::
NodeId
,
node_span
:
Span
,
is_block
:
bool
)
->
NodeInfo
{
pub
fn
get_cleanup_debug_loc_for_ast_node
<
'a
,
'tcx
>
(
cx
:
&
CrateContext
<
'a
,
'tcx
>
,
node_id
:
ast
::
NodeId
,
node_span
:
Span
,
is_block
:
bool
)
->
NodeInfo
{
// A debug location needs two things:
// (1) A span (of which only the beginning will actually be used)
// (2) An AST node-id which will be used to look up the lexical scope
...
...
@@ -1080,15 +1081,25 @@ pub fn get_cleanup_debug_loc_for_ast_node(node_id: ast::NodeId,
// scope is actually left when the cleanup code is executed.
// In practice it shouldn't make much of a difference.
let
cleanup_span
=
if
is_block
{
Span
{
lo
:
node_span
.hi
-
codemap
::
BytePos
(
1
),
// closing brace should always be 1 byte...
hi
:
node_span
.hi
,
expn_id
:
node_span
.expn_id
let
mut
cleanup_span
=
node_span
;
if
is_block
{
// Not all blocks actually have curly braces (e.g. simple closure
// bodies), in which case we also just want to return the span of the
// whole expression.
let
code_snippet
=
cx
.sess
()
.codemap
()
.span_to_snippet
(
node_span
);
if
let
Some
(
code_snippet
)
=
code_snippet
{
let
bytes
=
code_snippet
.as_bytes
();
if
bytes
.len
()
>
0
&&
bytes
[
bytes
.len
()
-
1
..
]
==
b
"}"
{
cleanup_span
=
Span
{
lo
:
node_span
.hi
-
codemap
::
BytePos
(
1
),
hi
:
node_span
.hi
,
expn_id
:
node_span
.expn_id
};
}
}
}
else
{
node_span
};
}
NodeInfo
{
id
:
node_id
,
...
...
src/librustc_trans/trans/expr.rs
浏览文件 @
61a0a7f0
...
...
@@ -97,7 +97,8 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
debug!
(
"trans_into() expr={}"
,
expr
.repr
(
bcx
.tcx
()));
let
cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
expr
.id
,
let
cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
bcx
.ccx
(),
expr
.id
,
expr
.span
,
false
);
bcx
.fcx
.push_ast_cleanup_scope
(
cleanup_debug_loc
);
...
...
@@ -130,7 +131,8 @@ pub fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
let
mut
bcx
=
bcx
;
let
fcx
=
bcx
.fcx
;
let
cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
expr
.id
,
let
cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
bcx
.ccx
(),
expr
.id
,
expr
.span
,
false
);
fcx
.push_ast_cleanup_scope
(
cleanup_debug_loc
);
...
...
@@ -621,7 +623,10 @@ fn trans_datum_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
ast
::
ExprRepeat
(
..
)
|
ast
::
ExprVec
(
..
)
=>
{
// Special case for slices.
let
cleanup_debug_loc
=
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
x
.id
,
x
.span
,
false
);
debuginfo
::
get_cleanup_debug_loc_for_ast_node
(
bcx
.ccx
(),
x
.id
,
x
.span
,
false
);
fcx
.push_ast_cleanup_scope
(
cleanup_debug_loc
);
let
datum
=
unpack_datum!
(
bcx
,
tvec
::
trans_slice_vec
(
bcx
,
expr
,
&**
x
));
...
...
src/test/debuginfo/multi-byte-chars.rs
0 → 100644
浏览文件 @
61a0a7f0
// Copyright 2013-2014 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.
// ignore-android: FIXME(#10381)
// min-lldb-version: 310
// compile-flags:-g
#![feature(non_ascii_idents)]
// This test checks whether debuginfo generation can handle multi-byte UTF-8
// characters at the end of a block. There's no need to do anything in the
// debugger -- just make sure that the compiler doesn't crash.
// See also issue #18791.
struct
C
{
θ
:
u8
}
fn
main
()
{
let
x
=
C
{
θ
:
0
};
(|
c
:
C
|
c
.θ
)(
x
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录