Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
8efd9dd8
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,发现更多精彩内容 >>
提交
8efd9dd8
编写于
10月 09, 2018
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
codegen_llvm/misc: whitespace & formatting improvements
上级
b1a137d0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
45 deletion
+46
-45
src/librustc_codegen_llvm/debuginfo/metadata.rs
src/librustc_codegen_llvm/debuginfo/metadata.rs
+15
-15
src/librustc_codegen_llvm/debuginfo/type_names.rs
src/librustc_codegen_llvm/debuginfo/type_names.rs
+1
-1
src/librustc_codegen_llvm/mir/analyze.rs
src/librustc_codegen_llvm/mir/analyze.rs
+3
-3
src/librustc_codegen_llvm/mir/block.rs
src/librustc_codegen_llvm/mir/block.rs
+23
-22
src/librustc_codegen_llvm/mir/mod.rs
src/librustc_codegen_llvm/mir/mod.rs
+4
-4
未找到文件。
src/librustc_codegen_llvm/debuginfo/metadata.rs
浏览文件 @
8efd9dd8
...
...
@@ -582,12 +582,12 @@ pub fn type_metadata(
}
ty
::
Dynamic
(
..
)
=>
{
MetadataCreationResult
::
new
(
trait_pointer_metadata
(
cx
,
t
,
None
,
unique_type_id
),
false
)
trait_pointer_metadata
(
cx
,
t
,
None
,
unique_type_id
),
false
)
}
ty
::
Foreign
(
..
)
=>
{
MetadataCreationResult
::
new
(
foreign_type_metadata
(
cx
,
t
,
unique_type_id
),
foreign_type_metadata
(
cx
,
t
,
unique_type_id
),
false
)
}
ty
::
RawPtr
(
ty
::
TypeAndMut
{
ty
,
..
})
|
...
...
@@ -646,16 +646,16 @@ pub fn type_metadata(
}
AdtKind
::
Union
=>
{
prepare_union_metadata
(
cx
,
t
,
unique_type_id
,
usage_site_span
)
.finalize
(
cx
)
t
,
unique_type_id
,
usage_site_span
)
.finalize
(
cx
)
}
AdtKind
::
Enum
=>
{
prepare_enum_metadata
(
cx
,
t
,
def
.did
,
unique_type_id
,
usage_site_span
)
.finalize
(
cx
)
t
,
def
.did
,
unique_type_id
,
usage_site_span
)
.finalize
(
cx
)
}
},
ty
::
Tuple
(
ref
elements
)
=>
{
...
...
@@ -943,7 +943,7 @@ enum MemberDescriptionFactory<'ll, 'tcx> {
impl
MemberDescriptionFactory
<
'll
,
'tcx
>
{
fn
create_member_descriptions
(
&
self
,
cx
:
&
CodegenCx
<
'll
,
'tcx
>
)
->
Vec
<
MemberDescription
<
'll
>>
{
->
Vec
<
MemberDescription
<
'll
>>
{
match
*
self
{
StructMDF
(
ref
this
)
=>
{
this
.create_member_descriptions
(
cx
)
...
...
@@ -977,7 +977,7 @@ struct StructMemberDescriptionFactory<'tcx> {
impl
<
'tcx
>
StructMemberDescriptionFactory
<
'tcx
>
{
fn
create_member_descriptions
(
&
self
,
cx
:
&
CodegenCx
<
'll
,
'tcx
>
)
->
Vec
<
MemberDescription
<
'll
>>
{
->
Vec
<
MemberDescription
<
'll
>>
{
let
layout
=
cx
.layout_of
(
self
.ty
);
self
.variant.fields
.iter
()
.enumerate
()
.map
(|(
i
,
f
)|
{
let
name
=
if
self
.variant.ctor_kind
==
CtorKind
::
Fn
{
...
...
@@ -1047,7 +1047,7 @@ struct TupleMemberDescriptionFactory<'tcx> {
impl
<
'tcx
>
TupleMemberDescriptionFactory
<
'tcx
>
{
fn
create_member_descriptions
(
&
self
,
cx
:
&
CodegenCx
<
'll
,
'tcx
>
)
->
Vec
<
MemberDescription
<
'll
>>
{
->
Vec
<
MemberDescription
<
'll
>>
{
let
layout
=
cx
.layout_of
(
self
.ty
);
self
.component_types
.iter
()
.enumerate
()
.map
(|(
i
,
&
component_type
)|
{
let
(
size
,
align
)
=
cx
.size_and_align_of
(
component_type
);
...
...
@@ -1101,7 +1101,7 @@ struct UnionMemberDescriptionFactory<'tcx> {
impl
<
'tcx
>
UnionMemberDescriptionFactory
<
'tcx
>
{
fn
create_member_descriptions
(
&
self
,
cx
:
&
CodegenCx
<
'll
,
'tcx
>
)
->
Vec
<
MemberDescription
<
'll
>>
{
->
Vec
<
MemberDescription
<
'll
>>
{
self
.variant.fields
.iter
()
.enumerate
()
.map
(|(
i
,
f
)|
{
let
field
=
self
.layout
.field
(
cx
,
i
);
let
(
size
,
align
)
=
field
.size_and_align
();
...
...
@@ -1170,7 +1170,7 @@ struct EnumMemberDescriptionFactory<'ll, 'tcx> {
impl
EnumMemberDescriptionFactory
<
'll
,
'tcx
>
{
fn
create_member_descriptions
(
&
self
,
cx
:
&
CodegenCx
<
'll
,
'tcx
>
)
->
Vec
<
MemberDescription
<
'll
>>
{
->
Vec
<
MemberDescription
<
'll
>>
{
let
adt
=
&
self
.enum_type
.ty_adt_def
()
.unwrap
();
match
self
.layout.variants
{
layout
::
Variants
::
Single
{
..
}
if
adt
.variants
.is_empty
()
=>
vec!
[],
...
...
src/librustc_codegen_llvm/debuginfo/type_names.rs
浏览文件 @
8efd9dd8
...
...
@@ -179,7 +179,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
ty
::
GeneratorWitness
(
..
)
|
ty
::
Param
(
_
)
=>
{
bug!
(
"debuginfo: Trying to create type name for
\
unexpected type: {:?}"
,
t
);
unexpected type: {:?}"
,
t
);
}
}
...
...
src/librustc_codegen_llvm/mir/analyze.rs
浏览文件 @
8efd9dd8
...
...
@@ -151,9 +151,9 @@ fn visit_terminator_kind(&mut self,
}
fn
visit_place
(
&
mut
self
,
place
:
&
mir
::
Place
<
'tcx
>
,
context
:
PlaceContext
<
'tcx
>
,
location
:
Location
)
{
place
:
&
mir
::
Place
<
'tcx
>
,
context
:
PlaceContext
<
'tcx
>
,
location
:
Location
)
{
debug!
(
"visit_place(place={:?}, context={:?})"
,
place
,
context
);
let
cx
=
self
.fx.cx
;
...
...
src/librustc_codegen_llvm/mir/block.rs
浏览文件 @
8efd9dd8
...
...
@@ -49,9 +49,9 @@ pub fn codegen_block(&mut self, bb: mir::BasicBlock) {
}
fn
codegen_terminator
(
&
mut
self
,
mut
bx
:
Builder
<
'a
,
'll
,
'tcx
>
,
bb
:
mir
::
BasicBlock
,
terminator
:
&
mir
::
Terminator
<
'tcx
>
)
mut
bx
:
Builder
<
'a
,
'll
,
'tcx
>
,
bb
:
mir
::
BasicBlock
,
terminator
:
&
mir
::
Terminator
<
'tcx
>
)
{
debug!
(
"codegen_terminator: {:?}"
,
terminator
);
...
...
@@ -125,10 +125,10 @@ fn codegen_terminator(&mut self,
this
.unreachable_block
()
};
let
invokeret
=
bx
.invoke
(
fn_ptr
,
&
llargs
,
ret_bx
,
llblock
(
this
,
cleanup
),
cleanup_bundle
);
&
llargs
,
ret_bx
,
llblock
(
this
,
cleanup
),
cleanup_bundle
);
fn_ty
.apply_attrs_callsite
(
&
bx
,
invokeret
);
if
let
Some
((
ret_dest
,
target
))
=
destination
{
...
...
@@ -213,7 +213,8 @@ fn codegen_terminator(&mut self,
}
else
{
let
(
otherwise
,
targets
)
=
targets
.split_last
()
.unwrap
();
let
switch
=
bx
.switch
(
discr
.immediate
(),
llblock
(
self
,
*
otherwise
),
values
.len
());
llblock
(
self
,
*
otherwise
),
values
.len
());
let
switch_llty
=
bx
.cx
.layout_of
(
switch_ty
)
.immediate_llvm_type
(
bx
.cx
);
for
(
&
value
,
target
)
in
values
.iter
()
.zip
(
targets
)
{
let
llval
=
C_uint_big
(
switch_llty
,
value
);
...
...
@@ -387,8 +388,8 @@ fn codegen_terminator(&mut self,
let
msg_str
=
Symbol
::
intern
(
str
)
.as_str
();
let
msg_str
=
C_str_slice
(
bx
.cx
,
msg_str
);
let
msg_file_line_col
=
C_struct
(
bx
.cx
,
&
[
msg_str
,
filename
,
line
,
col
],
false
);
&
[
msg_str
,
filename
,
line
,
col
],
false
);
let
msg_file_line_col
=
consts
::
addr_of
(
bx
.cx
,
msg_file_line_col
,
align
,
...
...
@@ -509,8 +510,8 @@ fn codegen_terminator(&mut self,
let
msg_str
=
Symbol
::
intern
(
&
str
)
.as_str
();
let
msg_str
=
C_str_slice
(
bx
.cx
,
msg_str
);
let
msg_file_line_col
=
C_struct
(
bx
.cx
,
&
[
msg_str
,
filename
,
line
,
col
],
false
);
&
[
msg_str
,
filename
,
line
,
col
],
false
);
let
msg_file_line_col
=
consts
::
addr_of
(
bx
.cx
,
msg_file_line_col
,
align
,
...
...
@@ -619,7 +620,7 @@ fn codegen_terminator(&mut self,
let
callee_ty
=
instance
.as_ref
()
.unwrap
()
.ty
(
bx
.cx.tcx
);
codegen_intrinsic_call
(
&
bx
,
callee_ty
,
&
fn_ty
,
&
args
,
dest
,
terminator
.source_info.span
);
terminator
.source_info.span
);
if
let
ReturnDest
::
IndirectOperand
(
dst
,
_
)
=
ret_dest
{
self
.store_return
(
&
bx
,
ret_dest
,
&
fn_ty
.ret
,
dst
.llval
);
...
...
@@ -756,7 +757,7 @@ fn codegen_argument(&mut self,
// Have to load the argument, maybe while casting it.
if
let
PassMode
::
Cast
(
ty
)
=
arg
.mode
{
llval
=
bx
.load
(
bx
.pointercast
(
llval
,
ty
.llvm_type
(
bx
.cx
)
.ptr_to
()),
align
.min
(
arg
.layout.align
));
align
.min
(
arg
.layout.align
));
}
else
{
// We can't use `PlaceRef::load` here because the argument
// may have a type we don't treat as immediate, but the ABI
...
...
@@ -778,10 +779,10 @@ fn codegen_argument(&mut self,
}
fn
codegen_arguments_untupled
(
&
mut
self
,
bx
:
&
Builder
<
'a
,
'll
,
'tcx
>
,
operand
:
&
mir
::
Operand
<
'tcx
>
,
llargs
:
&
mut
Vec
<&
'll
Value
>
,
args
:
&
[
ArgType
<
'tcx
,
Ty
<
'tcx
>>
])
{
bx
:
&
Builder
<
'a
,
'll
,
'tcx
>
,
operand
:
&
mir
::
Operand
<
'tcx
>
,
llargs
:
&
mut
Vec
<&
'll
Value
>
,
args
:
&
[
ArgType
<
'tcx
,
Ty
<
'tcx
>>
])
{
let
tuple
=
self
.codegen_operand
(
bx
,
operand
);
// Handle both by-ref and immediate tuples.
...
...
@@ -933,8 +934,8 @@ fn make_return_dest(&mut self, bx: &Builder<'a, 'll, 'tcx>,
}
fn
codegen_transmute
(
&
mut
self
,
bx
:
&
Builder
<
'a
,
'll
,
'tcx
>
,
src
:
&
mir
::
Operand
<
'tcx
>
,
dst
:
&
mir
::
Place
<
'tcx
>
)
{
src
:
&
mir
::
Operand
<
'tcx
>
,
dst
:
&
mir
::
Place
<
'tcx
>
)
{
if
let
mir
::
Place
::
Local
(
index
)
=
*
dst
{
match
self
.locals
[
index
]
{
LocalRef
::
Place
(
place
)
=>
self
.codegen_transmute_into
(
bx
,
src
,
place
),
...
...
@@ -961,8 +962,8 @@ fn codegen_transmute(&mut self, bx: &Builder<'a, 'll, 'tcx>,
}
fn
codegen_transmute_into
(
&
mut
self
,
bx
:
&
Builder
<
'a
,
'll
,
'tcx
>
,
src
:
&
mir
::
Operand
<
'tcx
>
,
dst
:
PlaceRef
<
'll
,
'tcx
>
)
{
src
:
&
mir
::
Operand
<
'tcx
>
,
dst
:
PlaceRef
<
'll
,
'tcx
>
)
{
let
src
=
self
.codegen_operand
(
bx
,
src
);
let
llty
=
src
.layout
.llvm_type
(
bx
.cx
);
let
cast_ptr
=
bx
.pointercast
(
dst
.llval
,
llty
.ptr_to
());
...
...
src/librustc_codegen_llvm/mir/mod.rs
浏览文件 @
8efd9dd8
...
...
@@ -162,16 +162,16 @@ pub fn debug_loc(&mut self, source_info: mir::SourceInfo) -> (Option<&'ll DIScop
// corresponding to span's containing source scope. If so, we need to create a DIScope
// "extension" into that file.
fn
scope_metadata_for_loc
(
&
self
,
scope_id
:
mir
::
SourceScope
,
pos
:
BytePos
)
->
Option
<&
'll
DIScope
>
{
->
Option
<&
'll
DIScope
>
{
let
scope_metadata
=
self
.scopes
[
scope_id
]
.scope_metadata
;
if
pos
<
self
.scopes
[
scope_id
]
.file_start_pos
||
pos
>=
self
.scopes
[
scope_id
]
.file_end_pos
{
let
cm
=
self
.cx
.sess
()
.source_map
();
let
defining_crate
=
self
.debug_context
.get_ref
(
DUMMY_SP
)
.defining_crate
;
Some
(
debuginfo
::
extend_scope_to_file
(
self
.cx
,
scope_metadata
.unwrap
(),
&
cm
.lookup_char_pos
(
pos
)
.file
,
defining_crate
))
scope_metadata
.unwrap
(),
&
cm
.lookup_char_pos
(
pos
)
.file
,
defining_crate
))
}
else
{
scope_metadata
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录