Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1d1dc484
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,发现更多精彩内容 >>
提交
1d1dc484
编写于
10月 06, 2018
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
codegen_llvm_back: whitespace & formatting fixes
上级
06118eac
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
53 addition
and
62 deletion
+53
-62
src/librustc_codegen_llvm/back/archive.rs
src/librustc_codegen_llvm/back/archive.rs
+1
-0
src/librustc_codegen_llvm/back/link.rs
src/librustc_codegen_llvm/back/link.rs
+6
-9
src/librustc_codegen_llvm/back/lto.rs
src/librustc_codegen_llvm/back/lto.rs
+8
-9
src/librustc_codegen_llvm/back/rpath.rs
src/librustc_codegen_llvm/back/rpath.rs
+1
-2
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/back/write.rs
+27
-30
src/librustc_codegen_utils/linker.rs
src/librustc_codegen_utils/linker.rs
+5
-6
src/librustc_codegen_utils/symbol_export.rs
src/librustc_codegen_utils/symbol_export.rs
+5
-6
未找到文件。
src/librustc_codegen_llvm/back/archive.rs
浏览文件 @
1d1dc484
...
...
@@ -83,6 +83,7 @@ pub fn src_files(&mut self) -> Vec<String> {
if
self
.src_archive
()
.is_none
()
{
return
Vec
::
new
()
}
let
archive
=
self
.src_archive
.as_ref
()
.unwrap
()
.as_ref
()
.unwrap
();
let
ret
=
archive
.iter
()
.filter_map
(|
child
|
child
.ok
())
...
...
src/librustc_codegen_llvm/back/link.rs
浏览文件 @
1d1dc484
...
...
@@ -47,8 +47,8 @@
use
syntax
::
attr
;
pub
use
rustc_codegen_utils
::
link
::{
find_crate_name
,
filename_for_input
,
default_output_for_target
,
invalid_output_for_target
,
out_filename
,
check_file_is_writeable
,
filename_for_metadata
};
invalid_output_for_target
,
filename_for_metadata
,
out_filename
,
check_file_is_writeable
};
// The third parameter is for env vars, used on windows to set up the
// path for MSVC to find its DLLs, and gcc to find its bundled
...
...
@@ -147,9 +147,7 @@ pub(crate) fn link_binary(sess: &Session,
// Remove the temporary object file and metadata if we aren't saving temps
if
!
sess
.opts.cg.save_temps
{
if
sess
.opts.output_types
.should_codegen
()
&&
!
preserve_objects_for_their_debuginfo
(
sess
)
{
if
sess
.opts.output_types
.should_codegen
()
&&
!
preserve_objects_for_their_debuginfo
(
sess
)
{
for
obj
in
codegen_results
.modules
.iter
()
.filter_map
(|
m
|
m
.object
.as_ref
())
{
remove
(
sess
,
obj
);
}
...
...
@@ -814,8 +812,8 @@ fn escape_string(s: &[u8]) -> String {
.unwrap_or_else
(|
_
|
{
let
mut
x
=
"Non-UTF-8 output: "
.to_string
();
x
.extend
(
s
.iter
()
.flat_map
(|
&
b
|
ascii
::
escape_default
(
b
))
.map
(|
b
|
char
::
from_u32
(
b
as
u32
)
.unwrap
()));
.flat_map
(|
&
b
|
ascii
::
escape_default
(
b
))
.map
(|
b
|
char
::
from_u32
(
b
as
u32
)
.unwrap
()));
x
})
}
...
...
@@ -1012,8 +1010,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// ensure the line is interpreted as one whole argument.
for
c
in
self
.arg
.chars
()
{
match
c
{
'\\'
|
' '
=>
write!
(
f
,
"
\\
{}"
,
c
)
?
,
'\\'
|
' '
=>
write!
(
f
,
"
\\
{}"
,
c
)
?
,
c
=>
write!
(
f
,
"{}"
,
c
)
?
,
}
}
...
...
src/librustc_codegen_llvm/back/lto.rs
浏览文件 @
1d1dc484
...
...
@@ -205,11 +205,11 @@ pub(crate) fn run(cgcx: &CodegenContext,
Lto
::
Fat
=>
{
assert
!
(
cached_modules
.is_empty
());
let
opt_jobs
=
fat_lto
(
cgcx
,
&
diag_handler
,
modules
,
upstream_modules
,
&
symbol_white_list
,
timeline
);
&
diag_handler
,
modules
,
upstream_modules
,
&
symbol_white_list
,
timeline
);
opt_jobs
.map
(|
opt_jobs
|
(
opt_jobs
,
vec!
[]))
}
Lto
::
Thin
|
...
...
@@ -310,8 +310,8 @@ fn fat_lto(cgcx: &CodegenContext,
unsafe
{
let
ptr
=
symbol_white_list
.as_ptr
();
llvm
::
LLVMRustRunRestrictionPass
(
llmod
,
ptr
as
*
const
*
const
libc
::
c_char
,
symbol_white_list
.len
()
as
libc
::
size_t
);
ptr
as
*
const
*
const
libc
::
c_char
,
symbol_white_list
.len
()
as
libc
::
size_t
);
cgcx
.save_temp_bitcode
(
&
module
,
"lto.after-restriction"
);
}
...
...
@@ -617,8 +617,7 @@ fn run_pass_manager(cgcx: &CodegenContext,
llvm
::
LLVMRustAddPass
(
pm
,
pass
.unwrap
());
}
time_ext
(
cgcx
.time_passes
,
None
,
"LTO passes"
,
||
llvm
::
LLVMRunPassManager
(
pm
,
llmod
));
time_ext
(
cgcx
.time_passes
,
None
,
"LTO passes"
,
||
llvm
::
LLVMRunPassManager
(
pm
,
llmod
));
llvm
::
LLVMDisposePassManager
(
pm
);
}
...
...
src/librustc_codegen_llvm/back/rpath.rs
浏览文件 @
1d1dc484
...
...
@@ -117,8 +117,7 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String
let
relative
=
path_relative_from
(
&
lib
,
&
output
)
.unwrap_or_else
(||
panic!
(
"couldn't create relative path from {:?} to {:?}"
,
output
,
lib
));
// FIXME (#9639): This needs to handle non-utf8 paths
format!
(
"{}/{}"
,
prefix
,
relative
.to_str
()
.expect
(
"non-utf8 component in path"
))
format!
(
"{}/{}"
,
prefix
,
relative
.to_str
()
.expect
(
"non-utf8 component in path"
))
}
// This routine is adapted from the *old* Path's `path_relative_from`
...
...
src/librustc_codegen_llvm/back/write.rs
浏览文件 @
1d1dc484
...
...
@@ -106,8 +106,7 @@ pub fn write_output_file(
file_type
:
llvm
::
FileType
)
->
Result
<
(),
FatalError
>
{
unsafe
{
let
output_c
=
path2cstr
(
output
);
let
result
=
llvm
::
LLVMRustWriteOutputFile
(
target
,
pm
,
m
,
output_c
.as_ptr
(),
file_type
);
let
result
=
llvm
::
LLVMRustWriteOutputFile
(
target
,
pm
,
m
,
output_c
.as_ptr
(),
file_type
);
if
result
.into_result
()
.is_err
()
{
let
msg
=
format!
(
"could not write output to {}"
,
output
.display
());
Err
(
llvm_err
(
handler
,
msg
))
...
...
@@ -590,8 +589,7 @@ unsafe fn optimize(cgcx: &CodegenContext,
for
pass
in
&
config
.passes
{
if
!
addpass
(
pass
)
{
diag_handler
.warn
(
&
format!
(
"unknown pass `{}`, ignoring"
,
pass
));
diag_handler
.warn
(
&
format!
(
"unknown pass `{}`, ignoring"
,
pass
));
}
if
pass
==
"name-anon-globals"
{
have_name_anon_globals_pass
=
true
;
...
...
@@ -601,8 +599,8 @@ unsafe fn optimize(cgcx: &CodegenContext,
for
pass
in
&
cgcx
.plugin_passes
{
if
!
addpass
(
pass
)
{
diag_handler
.err
(
&
format!
(
"a plugin asked for LLVM pass
\
`{}` but LLVM does not
\
recognize it"
,
pass
));
`{}` but LLVM does not
\
recognize it"
,
pass
));
}
if
pass
==
"name-anon-globals"
{
have_name_anon_globals_pass
=
true
;
...
...
@@ -613,12 +611,12 @@ unsafe fn optimize(cgcx: &CodegenContext,
// As described above, this will probably cause an error in LLVM
if
config
.no_prepopulate_passes
{
diag_handler
.err
(
"The current compilation is going to use thin LTO buffers
\
without running LLVM's NameAnonGlobals pass.
\
This will likely cause errors in LLVM. Consider adding
\
-C passes=name-anon-globals to the compiler command line."
);
without running LLVM's NameAnonGlobals pass.
\
This will likely cause errors in LLVM. Consider adding
\
-C passes=name-anon-globals to the compiler command line."
);
}
else
{
bug!
(
"We are using thin LTO buffers without running the NameAnonGlobals pass.
\
This will likely cause errors in LLVM and should never happen."
);
This will likely cause errors in LLVM and should never happen."
);
}
}
}
...
...
@@ -704,9 +702,9 @@ unsafe fn codegen(cgcx: &CodegenContext,
// escape the closure itself, and the manager should only be
// used once.
unsafe
fn
with_codegen
<
'll
,
F
,
R
>
(
tm
:
&
'll
llvm
::
TargetMachine
,
llmod
:
&
'll
llvm
::
Module
,
no_builtins
:
bool
,
f
:
F
)
->
R
llmod
:
&
'll
llvm
::
Module
,
no_builtins
:
bool
,
f
:
F
)
->
R
where
F
:
FnOnce
(
&
'll
mut
PassManager
<
'll
>
)
->
R
,
{
let
cpm
=
llvm
::
LLVMCreatePassManager
();
...
...
@@ -818,7 +816,7 @@ extern "C" fn demangle_callback(input_ptr: *const c_char,
};
with_codegen
(
tm
,
llmod
,
config
.no_builtins
,
|
cpm
|
{
write_output_file
(
diag_handler
,
tm
,
cpm
,
llmod
,
&
path
,
llvm
::
FileType
::
AssemblyFile
)
llvm
::
FileType
::
AssemblyFile
)
})
?
;
timeline
.record
(
"asm"
);
}
...
...
@@ -826,7 +824,7 @@ extern "C" fn demangle_callback(input_ptr: *const c_char,
if
write_obj
{
with_codegen
(
tm
,
llmod
,
config
.no_builtins
,
|
cpm
|
{
write_output_file
(
diag_handler
,
tm
,
cpm
,
llmod
,
&
obj_out
,
llvm
::
FileType
::
ObjectFile
)
llvm
::
FileType
::
ObjectFile
)
})
?
;
timeline
.record
(
"obj"
);
}
else
if
asm_to_obj
{
...
...
@@ -947,11 +945,11 @@ fn need_pre_thin_lto_bitcode_for_incr_comp(sess: &Session) -> bool {
}
pub
fn
start_async_codegen
(
tcx
:
TyCtxt
,
time_graph
:
Option
<
TimeGraph
>
,
metadata
:
EncodedMetadata
,
coordinator_receive
:
Receiver
<
Box
<
dyn
Any
+
Send
>>
,
total_cgus
:
usize
)
->
OngoingCodegen
{
time_graph
:
Option
<
TimeGraph
>
,
metadata
:
EncodedMetadata
,
coordinator_receive
:
Receiver
<
Box
<
dyn
Any
+
Send
>>
,
total_cgus
:
usize
)
->
OngoingCodegen
{
let
sess
=
tcx
.sess
;
let
crate_name
=
tcx
.crate_name
(
LOCAL_CRATE
);
let
crate_hash
=
tcx
.crate_hash
(
LOCAL_CRATE
);
...
...
@@ -1116,7 +1114,8 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
}
if
let
Some
((
id
,
product
))
=
copy_cgu_workproducts_to_incr_comp_cache_dir
(
sess
,
&
module
.name
,
&
files
)
{
copy_cgu_workproducts_to_incr_comp_cache_dir
(
sess
,
&
module
.name
,
&
files
)
{
work_products
.insert
(
id
,
product
);
}
}
...
...
@@ -1584,10 +1583,8 @@ fn start_executing_work(tcx: TyCtxt,
let
(
name
,
mut
cmd
)
=
get_linker
(
sess
,
&
linker
,
flavor
);
cmd
.args
(
&
sess
.target.target.options.asm_args
);
Some
(
Arc
::
new
(
AssemblerCommand
{
name
,
cmd
,
}))
Some
(
Arc
::
new
(
AssemblerCommand
{
name
,
cmd
}))
}
else
{
None
};
...
...
@@ -2186,9 +2183,9 @@ pub fn run_assembler(cgcx: &CodegenContext, handler: &Handler, assembly: &Path,
handler
.struct_err
(
&
format!
(
"linking with `{}` failed: {}"
,
pname
.display
(),
prog
.status
))
.note
(
&
format!
(
"{:?}"
,
&
cmd
))
.note
(
str
::
from_utf8
(
&
note
[
..
])
.unwrap
())
.emit
();
.note
(
&
format!
(
"{:?}"
,
&
cmd
))
.note
(
str
::
from_utf8
(
&
note
[
..
])
.unwrap
())
.emit
();
handler
.abort_if_errors
();
}
},
...
...
@@ -2450,8 +2447,8 @@ pub(crate) fn join(
}
pub
(
crate
)
fn
submit_pre_codegened_module_to_llvm
(
&
self
,
tcx
:
TyCtxt
,
module
:
ModuleCodegen
)
{
tcx
:
TyCtxt
,
module
:
ModuleCodegen
)
{
self
.wait_for_signal_to_codegen_item
();
self
.check_for_errors
(
tcx
.sess
);
...
...
src/librustc_codegen_utils/linker.rs
浏览文件 @
1d1dc484
...
...
@@ -224,9 +224,9 @@ fn push_cross_lang_lto_args(&mut self, plugin_path: Option<&OsStr>) {
}
impl
<
'a
>
Linker
for
GccLinker
<
'a
>
{
fn
link_dylib
(
&
mut
self
,
lib
:
&
str
)
{
self
.hint_dynamic
();
self
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
}
fn
link_dylib
(
&
mut
self
,
lib
:
&
str
)
{
self
.hint_dynamic
();
self
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
}
fn
link_staticlib
(
&
mut
self
,
lib
:
&
str
)
{
self
.hint_static
();
self
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
self
.hint_static
();
self
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
}
fn
link_rlib
(
&
mut
self
,
lib
:
&
Path
)
{
self
.hint_static
();
self
.cmd
.arg
(
lib
);
}
fn
include_path
(
&
mut
self
,
path
:
&
Path
)
{
self
.cmd
.arg
(
"-L"
)
.arg
(
path
);
}
...
...
@@ -243,7 +243,7 @@ fn link_staticlib(&mut self, lib: &str) {
fn
link_rust_dylib
(
&
mut
self
,
lib
:
&
str
,
_
path
:
&
Path
)
{
self
.hint_dynamic
();
self
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
self
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
}
fn
link_framework
(
&
mut
self
,
framework
:
&
str
)
{
...
...
@@ -261,7 +261,7 @@ fn link_whole_staticlib(&mut self, lib: &str, search_path: &[PathBuf]) {
self
.hint_static
();
let
target
=
&
self
.sess.target.target
;
if
!
target
.options.is_like_osx
{
self
.linker_arg
(
"--whole-archive"
)
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
self
.linker_arg
(
"--whole-archive"
)
.cmd
.arg
(
format!
(
"-l{}"
,
lib
));
self
.linker_arg
(
"--no-whole-archive"
);
}
else
{
// -force_load is the macOS equivalent of --whole-archive, but it
...
...
@@ -373,8 +373,7 @@ fn build_dylib(&mut self, out_filename: &Path) {
// purely to support rustbuild right now, we should get a more
// principled solution at some point to force the compiler to pass
// the right `-Wl,-install_name` with an `@rpath` in it.
if
self
.sess.opts.cg.rpath
||
self
.sess.opts.debugging_opts.osx_rpath_install_name
{
if
self
.sess.opts.cg.rpath
||
self
.sess.opts.debugging_opts.osx_rpath_install_name
{
self
.linker_arg
(
"-install_name"
);
let
mut
v
=
OsString
::
from
(
"@rpath/"
);
v
.push
(
out_filename
.file_name
()
.unwrap
());
...
...
src/librustc_codegen_utils/symbol_export.rs
浏览文件 @
1d1dc484
...
...
@@ -47,11 +47,10 @@ fn crate_export_threshold(crate_type: config::CrateType) -> SymbolExportLevel {
}
}
pub
fn
crates_export_threshold
(
crate_types
:
&
[
config
::
CrateType
])
->
SymbolExportLevel
{
if
crate_types
.iter
()
.any
(|
&
crate_type
|
{
crate_export_threshold
(
crate_type
)
==
SymbolExportLevel
::
Rust
})
{
pub
fn
crates_export_threshold
(
crate_types
:
&
[
config
::
CrateType
])
->
SymbolExportLevel
{
if
crate_types
.iter
()
.any
(|
&
crate_type
|
crate_export_threshold
(
crate_type
)
==
SymbolExportLevel
::
Rust
)
{
SymbolExportLevel
::
Rust
}
else
{
SymbolExportLevel
::
C
...
...
@@ -359,7 +358,7 @@ fn is_unreachable_local_definition_provider(tcx: TyCtxt, def_id: DefId) -> bool
!
tcx
.reachable_set
(
LOCAL_CRATE
)
.0
.contains
(
&
node_id
)
}
else
{
bug!
(
"is_unreachable_local_definition called with non-local DefId: {:?}"
,
def_id
)
def_id
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录