Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e135fa5b
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,发现更多精彩内容 >>
提交
e135fa5b
编写于
11月 27, 2014
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove dependencies on driver from trans et al. by moving various
structs out from driver and into other places.
上级
cc32f867
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
171 addition
and
195 deletion
+171
-195
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+11
-0
src/librustc/session/config.rs
src/librustc/session/config.rs
+53
-0
src/librustc_trans/back/link.rs
src/librustc_trans/back/link.rs
+3
-5
src/librustc_trans/back/write.rs
src/librustc_trans/back/write.rs
+2
-2
src/librustc_trans/driver/driver.rs
src/librustc_trans/driver/driver.rs
+15
-99
src/librustc_trans/driver/mod.rs
src/librustc_trans/driver/mod.rs
+7
-7
src/librustc_trans/driver/pretty.rs
src/librustc_trans/driver/pretty.rs
+6
-5
src/librustc_trans/save/mod.rs
src/librustc_trans/save/mod.rs
+2
-3
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/base.rs
+5
-15
src/librustc_trans/trans/common.rs
src/librustc_trans/trans/common.rs
+0
-5
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/context.rs
+0
-4
src/librustc_trans/trans/datum.rs
src/librustc_trans/trans/datum.rs
+0
-7
src/librustc_trans/trans/mod.rs
src/librustc_trans/trans/mod.rs
+61
-37
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+2
-2
src/librustdoc/core.rs
src/librustdoc/core.rs
+2
-2
src/librustdoc/test.rs
src/librustdoc/test.rs
+2
-2
未找到文件。
src/librustc/middle/ty.rs
浏览文件 @
e135fa5b
...
...
@@ -92,6 +92,17 @@
// Data types
/// The complete set of all analyses described in this module. This is
/// produced by the driver and fed to trans and later passes.
pub
struct
CrateAnalysis
<
'tcx
>
{
pub
exp_map2
:
middle
::
resolve
::
ExportMap2
,
pub
exported_items
:
middle
::
privacy
::
ExportedItems
,
pub
public_items
:
middle
::
privacy
::
PublicItems
,
pub
ty_cx
:
ty
::
ctxt
<
'tcx
>
,
pub
reachable
:
NodeSet
,
pub
name
:
String
,
}
#[deriving(PartialEq,
Eq,
Hash)]
pub
struct
field
<
'tcx
>
{
pub
name
:
ast
::
Name
,
...
...
src/librustc/session/config.rs
浏览文件 @
e135fa5b
...
...
@@ -114,6 +114,59 @@ pub struct Options {
pub
alt_std_name
:
Option
<
String
>
}
pub
enum
Input
{
/// Load source from file
File
(
Path
),
/// The string is the source
Str
(
String
)
}
impl
Input
{
pub
fn
filestem
(
&
self
)
->
String
{
match
*
self
{
Input
::
File
(
ref
ifile
)
=>
ifile
.filestem_str
()
.unwrap
()
.to_string
(),
Input
::
Str
(
_
)
=>
"rust_out"
.to_string
(),
}
}
}
#[deriving(Clone)]
pub
struct
OutputFilenames
{
pub
out_directory
:
Path
,
pub
out_filestem
:
String
,
pub
single_output_file
:
Option
<
Path
>
,
pub
extra
:
String
,
}
impl
OutputFilenames
{
pub
fn
path
(
&
self
,
flavor
:
OutputType
)
->
Path
{
match
self
.single_output_file
{
Some
(
ref
path
)
=>
return
path
.clone
(),
None
=>
{}
}
self
.temp_path
(
flavor
)
}
pub
fn
temp_path
(
&
self
,
flavor
:
OutputType
)
->
Path
{
let
base
=
self
.out_directory
.join
(
self
.filestem
());
match
flavor
{
OutputTypeBitcode
=>
base
.with_extension
(
"bc"
),
OutputTypeAssembly
=>
base
.with_extension
(
"s"
),
OutputTypeLlvmAssembly
=>
base
.with_extension
(
"ll"
),
OutputTypeObject
=>
base
.with_extension
(
"o"
),
OutputTypeExe
=>
base
,
}
}
pub
fn
with_extension
(
&
self
,
extension
:
&
str
)
->
Path
{
self
.out_directory
.join
(
self
.filestem
())
.with_extension
(
extension
)
}
pub
fn
filestem
(
&
self
)
->
String
{
format!
(
"{}{}"
,
self
.out_filestem
,
self
.extra
)
}
}
pub
fn
host_triple
()
->
&
'static
str
{
// Get the host triple out of the build environment. This ensures that our
// idea of the host triple is the same as for the set of libraries we've
...
...
src/librustc_trans/back/link.rs
浏览文件 @
e135fa5b
...
...
@@ -13,15 +13,13 @@
use
super
::
rpath
;
use
super
::
rpath
::
RPathConfig
;
use
super
::
svh
::
Svh
;
use
driver
::
driver
::{
CrateTranslation
,
OutputFilenames
,
Input
,
FileInput
};
use
session
::
config
;
use
session
::
config
::
NoDebugInfo
;
use
session
::
config
::{
OutputTypeBitcode
,
OutputTypeExe
,
OutputTypeObject
};
use
session
::
config
::{
Output
Filenames
,
Input
,
Output
TypeBitcode
,
OutputTypeExe
,
OutputTypeObject
};
use
session
::
Session
;
use
metadata
::
common
::
LinkMeta
;
use
metadata
::{
encoder
,
cstore
,
filesearch
,
csearch
,
creader
};
use
trans
::
context
::
CrateContext
;
use
trans
::
common
::
gensym_name
;
use
trans
::{
CrateContext
,
CrateTranslation
,
gensym_name
};
use
middle
::
ty
::{
mod
,
Ty
};
use
util
::
common
::
time
;
use
util
::
ppaux
;
...
...
@@ -156,7 +154,7 @@ pub fn find_crate_name(sess: Option<&Session>,
if
let
Some
((
attr
,
s
))
=
attr_crate_name
{
return
validate
(
s
.get
()
.to_string
(),
Some
(
attr
.span
));
}
if
let
FileInput
(
ref
path
)
=
*
input
{
if
let
Input
::
File
(
ref
path
)
=
*
input
{
if
let
Some
(
s
)
=
path
.filestem_str
()
{
return
validate
(
s
.to_string
(),
None
);
}
...
...
src/librustc_trans/back/write.rs
浏览文件 @
e135fa5b
...
...
@@ -10,13 +10,13 @@
use
back
::
lto
;
use
back
::
link
::{
get_cc_prog
,
remove
};
use
driver
::
driver
::{
CrateTranslation
,
ModuleTranslation
,
OutputFilenames
};
use
session
::
config
::{
NoDebugInfo
,
Passes
,
SomePasses
,
AllPasses
};
use
session
::
config
::{
OutputFilenames
,
NoDebugInfo
,
Passes
,
SomePasses
,
AllPasses
};
use
session
::
Session
;
use
session
::
config
;
use
llvm
;
use
llvm
::{
ModuleRef
,
TargetMachineRef
,
PassManagerRef
,
DiagnosticInfoRef
,
ContextRef
};
use
llvm
::
SMDiagnosticRef
;
use
trans
::{
CrateTranslation
,
ModuleTranslation
};
use
util
::
common
::
time
;
use
syntax
::
codemap
;
use
syntax
::
diagnostic
;
...
...
src/librustc_trans/driver/driver.rs
浏览文件 @
e135fa5b
...
...
@@ -8,15 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub
use
self
::
Input
::
*
;
use
back
::
link
;
use
back
::
write
;
use
session
::
Session
;
use
session
::
config
;
use
session
::
config
::{
mod
,
Input
,
OutputFilenames
}
;
use
lint
;
use
llvm
::{
ContextRef
,
ModuleRef
};
use
metadata
::
common
::
LinkMeta
;
use
metadata
::
creader
;
use
middle
::{
stability
,
ty
,
reachable
};
use
middle
::
dependency_format
;
...
...
@@ -28,7 +24,6 @@
use
trans
;
use
util
::
common
::
time
;
use
util
::
nodemap
::{
NodeSet
};
use
serialize
::{
json
,
Encodable
};
...
...
@@ -114,36 +109,19 @@ pub fn anon_src() -> String {
pub
fn
source_name
(
input
:
&
Input
)
->
String
{
match
*
input
{
// FIXME (#9639): This needs to handle non-utf8 paths
FileInput
(
ref
ifile
)
=>
ifile
.as_str
()
.unwrap
()
.to_string
(),
StrInput
(
_
)
=>
anon_src
()
}
}
pub
enum
Input
{
/// Load source from file
FileInput
(
Path
),
/// The string is the source
StrInput
(
String
)
}
impl
Input
{
fn
filestem
(
&
self
)
->
String
{
match
*
self
{
FileInput
(
ref
ifile
)
=>
ifile
.filestem_str
()
.unwrap
()
.to_string
(),
StrInput
(
_
)
=>
"rust_out"
.to_string
(),
}
Input
::
File
(
ref
ifile
)
=>
ifile
.as_str
()
.unwrap
()
.to_string
(),
Input
::
Str
(
_
)
=>
anon_src
()
}
}
pub
fn
phase_1_parse_input
(
sess
:
&
Session
,
cfg
:
ast
::
CrateConfig
,
input
:
&
Input
)
->
ast
::
Crate
{
let
krate
=
time
(
sess
.time_passes
(),
"parsing"
,
(),
|
_
|
{
match
*
input
{
FileInput
(
ref
file
)
=>
{
Input
::
File
(
ref
file
)
=>
{
parse
::
parse_crate_from_file
(
&
(
*
file
),
cfg
.clone
(),
&
sess
.parse_sess
)
}
StrInput
(
ref
src
)
=>
{
Input
::
Str
(
ref
src
)
=>
{
parse
::
parse_crate_from_source_str
(
anon_src
()
.to_string
(),
src
.to_string
(),
cfg
.clone
(),
...
...
@@ -343,23 +321,13 @@ fn new_id(&self, old_id: ast::NodeId) -> ast::NodeId {
map
}
pub
struct
CrateAnalysis
<
'tcx
>
{
pub
exp_map2
:
middle
::
resolve
::
ExportMap2
,
pub
exported_items
:
middle
::
privacy
::
ExportedItems
,
pub
public_items
:
middle
::
privacy
::
PublicItems
,
pub
ty_cx
:
ty
::
ctxt
<
'tcx
>
,
pub
reachable
:
NodeSet
,
pub
name
:
String
,
}
/// Run the resolution, typechecking, region checking and other
/// miscellaneous analysis passes on the crate. Return various
/// structures carrying the results of the analysis.
pub
fn
phase_3_run_analysis_passes
<
'tcx
>
(
sess
:
Session
,
ast_map
:
ast_map
::
Map
<
'tcx
>
,
type_arena
:
&
'tcx
TypedArena
<
ty
::
TyS
<
'tcx
>>
,
name
:
String
)
->
CrateAnalysis
<
'tcx
>
{
name
:
String
)
->
ty
::
CrateAnalysis
<
'tcx
>
{
let
time_passes
=
sess
.time_passes
();
let
krate
=
ast_map
.krate
();
...
...
@@ -474,7 +442,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
time
(
time_passes
,
"lint checking"
,
(),
|
_
|
lint
::
check_crate
(
&
ty_cx
,
&
exported_items
));
CrateAnalysis
{
ty
::
CrateAnalysis
{
exp_map2
:
exp_map2
,
ty_cx
:
ty_cx
,
exported_items
:
exported_items
,
...
...
@@ -486,7 +454,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
pub
fn
phase_save_analysis
(
sess
:
&
Session
,
krate
:
&
ast
::
Crate
,
analysis
:
&
CrateAnalysis
,
analysis
:
&
ty
::
CrateAnalysis
,
odir
:
&
Option
<
Path
>
)
{
if
(
sess
.opts.debugging_opts
&
config
::
SAVE_ANALYSIS
)
==
0
{
return
;
...
...
@@ -495,25 +463,10 @@ pub fn phase_save_analysis(sess: &Session,
save
::
process_crate
(
sess
,
krate
,
analysis
,
odir
));
}
pub
struct
ModuleTranslation
{
pub
llcx
:
ContextRef
,
pub
llmod
:
ModuleRef
,
}
pub
struct
CrateTranslation
{
pub
modules
:
Vec
<
ModuleTranslation
>
,
pub
metadata_module
:
ModuleTranslation
,
pub
link
:
LinkMeta
,
pub
metadata
:
Vec
<
u8
>
,
pub
reachable
:
Vec
<
String
>
,
pub
crate_formats
:
dependency_format
::
Dependencies
,
pub
no_builtins
:
bool
,
}
/// Run the translation phase to LLVM, after which the AST and analysis can
/// be discarded.
pub
fn
phase_4_translate_to_llvm
<
'tcx
>
(
analysis
:
CrateAnalysis
<
'tcx
>
)
->
(
ty
::
ctxt
<
'tcx
>
,
CrateTranslation
)
{
pub
fn
phase_4_translate_to_llvm
<
'tcx
>
(
analysis
:
ty
::
CrateAnalysis
<
'tcx
>
)
->
(
ty
::
ctxt
<
'tcx
>
,
trans
::
CrateTranslation
)
{
let
time_passes
=
analysis
.ty_cx.sess
.time_passes
();
time
(
time_passes
,
"resolving dependency formats"
,
(),
|
_
|
...
...
@@ -521,13 +474,13 @@ pub fn phase_4_translate_to_llvm<'tcx>(analysis: CrateAnalysis<'tcx>)
// Option dance to work around the lack of stack once closures.
time
(
time_passes
,
"translation"
,
analysis
,
|
analysis
|
trans
::
base
::
trans_crate
(
analysis
))
trans
::
trans_crate
(
analysis
))
}
/// Run LLVM itself, producing a bitcode file, assembly file or object file
/// as a side effect.
pub
fn
phase_5_run_llvm_passes
(
sess
:
&
Session
,
trans
:
&
CrateTranslation
,
trans
:
&
trans
::
CrateTranslation
,
outputs
:
&
OutputFilenames
)
{
if
sess
.opts.cg.no_integrated_as
{
let
output_type
=
config
::
OutputTypeAssembly
;
...
...
@@ -555,7 +508,7 @@ pub fn phase_5_run_llvm_passes(sess: &Session,
/// Run the linker on any artifacts that resulted from the LLVM run.
/// This should produce either a finished executable or library.
pub
fn
phase_6_link_output
(
sess
:
&
Session
,
trans
:
&
CrateTranslation
,
trans
:
&
trans
::
CrateTranslation
,
outputs
:
&
OutputFilenames
)
{
let
old_path
=
os
::
getenv
(
"PATH"
)
.unwrap_or_else
(||
String
::
new
());
let
mut
new_path
=
sess
.host_filesearch
()
.get_tools_search_paths
();
...
...
@@ -640,8 +593,8 @@ fn write_out_deps(sess: &Session,
// Use default filename: crate source filename with extension replaced
// by ".d"
(
true
,
None
)
=>
match
*
input
{
FileInput
(
..
)
=>
outputs
.with_extension
(
"d"
),
StrInput
(
..
)
=>
{
Input
::
File
(
..
)
=>
outputs
.with_extension
(
"d"
),
Input
::
Str
(
..
)
=>
{
sess
.warn
(
"can not write --dep-info without a filename
\
when compiling stdin."
);
return
...
...
@@ -752,43 +705,6 @@ pub fn collect_crate_metadata(session: &Session,
session
.opts.cg.metadata
.clone
()
}
#[deriving(Clone)]
pub
struct
OutputFilenames
{
pub
out_directory
:
Path
,
pub
out_filestem
:
String
,
pub
single_output_file
:
Option
<
Path
>
,
extra
:
String
,
}
impl
OutputFilenames
{
pub
fn
path
(
&
self
,
flavor
:
config
::
OutputType
)
->
Path
{
match
self
.single_output_file
{
Some
(
ref
path
)
=>
return
path
.clone
(),
None
=>
{}
}
self
.temp_path
(
flavor
)
}
pub
fn
temp_path
(
&
self
,
flavor
:
config
::
OutputType
)
->
Path
{
let
base
=
self
.out_directory
.join
(
self
.filestem
());
match
flavor
{
config
::
OutputTypeBitcode
=>
base
.with_extension
(
"bc"
),
config
::
OutputTypeAssembly
=>
base
.with_extension
(
"s"
),
config
::
OutputTypeLlvmAssembly
=>
base
.with_extension
(
"ll"
),
config
::
OutputTypeObject
=>
base
.with_extension
(
"o"
),
config
::
OutputTypeExe
=>
base
,
}
}
pub
fn
with_extension
(
&
self
,
extension
:
&
str
)
->
Path
{
self
.out_directory
.join
(
self
.filestem
())
.with_extension
(
extension
)
}
fn
filestem
(
&
self
)
->
String
{
format!
(
"{}{}"
,
self
.out_filestem
,
self
.extra
)
}
}
pub
fn
build_output_filenames
(
input
:
&
Input
,
odir
:
&
Option
<
Path
>
,
ofile
:
&
Option
<
Path
>
,
...
...
src/librustc_trans/driver/mod.rs
浏览文件 @
e135fa5b
...
...
@@ -11,8 +11,8 @@
pub
use
syntax
::
diagnostic
;
use
back
::
link
;
use
driver
::
driver
::{
Input
,
FileInput
,
StrInput
};
use
session
::{
config
,
Session
,
build_session
};
use
session
::
config
::
Input
;
use
lint
::
Lint
;
use
lint
;
use
metadata
;
...
...
@@ -89,9 +89,9 @@ fn run_compiler(args: &[String]) {
if
ifile
==
"-"
{
let
contents
=
io
::
stdin
()
.read_to_end
()
.unwrap
();
let
src
=
String
::
from_utf8
(
contents
)
.unwrap
();
(
StrInput
(
src
),
None
)
(
Input
::
Str
(
src
),
None
)
}
else
{
(
FileInput
(
Path
::
new
(
ifile
)),
Some
(
Path
::
new
(
ifile
)))
(
Input
::
File
(
Path
::
new
(
ifile
)),
Some
(
Path
::
new
(
ifile
)))
}
}
_
=>
early_error
(
"multiple input filenames provided"
)
...
...
@@ -116,11 +116,11 @@ fn run_compiler(args: &[String]) {
let
r
=
matches
.opt_strs
(
"Z"
);
if
r
.contains
(
&
(
"ls"
.to_string
()))
{
match
input
{
FileInput
(
ref
ifile
)
=>
{
Input
::
File
(
ref
ifile
)
=>
{
let
mut
stdout
=
io
::
stdout
();
list_metadata
(
&
sess
,
&
(
*
ifile
),
&
mut
stdout
)
.unwrap
();
}
StrInput
(
_
)
=>
{
Input
::
Str
(
_
)
=>
{
early_error
(
"can not list metadata for stdin"
);
}
}
...
...
@@ -411,12 +411,12 @@ fn print_crate_info(sess: &Session,
fn
parse_crate_attrs
(
sess
:
&
Session
,
input
:
&
Input
)
->
Vec
<
ast
::
Attribute
>
{
let
result
=
match
*
input
{
FileInput
(
ref
ifile
)
=>
{
Input
::
File
(
ref
ifile
)
=>
{
parse
::
parse_crate_attrs_from_file
(
ifile
,
Vec
::
new
(),
&
sess
.parse_sess
)
}
StrInput
(
ref
src
)
=>
{
Input
::
Str
(
ref
src
)
=>
{
parse
::
parse_crate_attrs_from_source_str
(
driver
::
anon_src
()
.to_string
(),
src
.to_string
(),
...
...
src/librustc_trans/driver/pretty.rs
浏览文件 @
e135fa5b
...
...
@@ -17,8 +17,9 @@
use
back
::
link
;
use
session
::{
config
,
Session
};
use
driver
::
driver
::{
mod
,
CrateAnalysis
};
use
session
::
Session
;
use
session
::
config
::{
mod
,
Input
};
use
driver
::
driver
::{
mod
};
use
middle
::
ty
;
use
middle
::
borrowck
::{
mod
,
FnPartsWithCFG
};
...
...
@@ -242,7 +243,7 @@ fn post(&self,
struct
TypedAnnotation
<
'tcx
>
{
analysis
:
CrateAnalysis
<
'tcx
>
,
analysis
:
ty
::
CrateAnalysis
<
'tcx
>
,
}
impl
<
'tcx
>
PrinterSupport
<
'tcx
>
for
TypedAnnotation
<
'tcx
>
{
...
...
@@ -409,7 +410,7 @@ fn needs_expansion(ppm: &PpMode) -> bool {
pub
fn
pretty_print_input
(
sess
:
Session
,
cfg
:
ast
::
CrateConfig
,
input
:
&
driver
::
Input
,
input
:
&
Input
,
ppm
:
PpMode
,
opt_uii
:
Option
<
UserIdentifiedItem
>
,
ofile
:
Option
<
Path
>
)
{
...
...
@@ -536,7 +537,7 @@ pub fn pretty_print_input(sess: Session,
}
fn
print_flowgraph
<
W
:
io
::
Writer
>
(
variants
:
Vec
<
borrowck_dot
::
Variant
>
,
analysis
:
CrateAnalysis
,
analysis
:
ty
::
CrateAnalysis
,
code
:
blocks
::
Code
,
mut
out
:
W
)
->
io
::
IoResult
<
()
>
{
let
ty_cx
=
&
analysis
.ty_cx
;
...
...
src/librustc_trans/save/mod.rs
浏览文件 @
e135fa5b
...
...
@@ -27,7 +27,6 @@
//! the format of the output away from extracting it from the compiler.
//! DxrVisitor walks the AST and processes it.
use
driver
::
driver
::
CrateAnalysis
;
use
session
::
Session
;
use
middle
::
def
;
...
...
@@ -68,7 +67,7 @@ fn generated_code(span: Span) -> bool {
struct
DxrVisitor
<
'l
,
'tcx
:
'l
>
{
sess
:
&
'l
Session
,
analysis
:
&
'l
CrateAnalysis
<
'tcx
>
,
analysis
:
&
'l
ty
::
CrateAnalysis
<
'tcx
>
,
collected_paths
:
Vec
<
(
NodeId
,
ast
::
Path
,
bool
,
recorder
::
Row
)
>
,
collecting
:
bool
,
...
...
@@ -1473,7 +1472,7 @@ fn visit_local(&mut self, l: &ast::Local) {
pub
fn
process_crate
(
sess
:
&
Session
,
krate
:
&
ast
::
Crate
,
analysis
:
&
CrateAnalysis
,
analysis
:
&
ty
::
CrateAnalysis
,
odir
:
&
Option
<
Path
>
)
{
if
generated_code
(
krate
.span
)
{
return
;
...
...
src/librustc_trans/trans/base.rs
浏览文件 @
e135fa5b
...
...
@@ -28,9 +28,11 @@
pub
use
self
::
ValueOrigin
::
*
;
pub
use
self
::
scalar_type
::
*
;
use
super
::
CrateTranslation
;
use
super
::
ModuleTranslation
;
use
back
::
link
::{
mangle_exported_name
};
use
back
::{
link
,
abi
};
use
driver
::
driver
::{
CrateAnalysis
,
CrateTranslation
,
ModuleTranslation
};
use
lint
;
use
llvm
::{
BasicBlockRef
,
Linkage
,
ValueRef
,
Vector
,
get_param
};
use
llvm
;
...
...
@@ -1078,12 +1080,6 @@ pub fn store_ty(cx: Block, v: ValueRef, dst: ValueRef, t: Ty) {
};
}
pub
fn
ignore_lhs
(
_
bcx
:
Block
,
local
:
&
ast
::
Local
)
->
bool
{
match
local
.pat.node
{
ast
::
PatWild
(
ast
::
PatWildSingle
)
=>
true
,
_
=>
false
}
}
pub
fn
init_local
<
'blk
,
'tcx
>
(
bcx
:
Block
<
'blk
,
'tcx
>
,
local
:
&
ast
::
Local
)
->
Block
<
'blk
,
'tcx
>
{
debug!
(
"init_local(bcx={}, local.id={})"
,
bcx
.to_str
(),
local
.id
);
...
...
@@ -2916,12 +2912,6 @@ fn register_method(ccx: &CrateContext, id: ast::NodeId,
llfn
}
pub
fn
p2i
(
ccx
:
&
CrateContext
,
v
:
ValueRef
)
->
ValueRef
{
unsafe
{
return
llvm
::
LLVMConstPtrToInt
(
v
,
ccx
.int_type
()
.to_ref
());
}
}
pub
fn
crate_ctxt_to_encode_parms
<
'a
,
'tcx
>
(
cx
:
&
'a
SharedCrateContext
<
'tcx
>
,
ie
:
encoder
::
EncodeInlinedItem
<
'a
>
)
->
encoder
::
EncodeParams
<
'a
,
'tcx
>
{
...
...
@@ -3055,9 +3045,9 @@ fn next(&mut self) -> Option<ValueRef> {
}
}
pub
fn
trans_crate
<
'tcx
>
(
analysis
:
CrateAnalysis
<
'tcx
>
)
pub
fn
trans_crate
<
'tcx
>
(
analysis
:
ty
::
CrateAnalysis
<
'tcx
>
)
->
(
ty
::
ctxt
<
'tcx
>
,
CrateTranslation
)
{
let
CrateAnalysis
{
ty_cx
:
tcx
,
exp_map2
,
reachable
,
name
,
..
}
=
analysis
;
let
ty
::
CrateAnalysis
{
ty_cx
:
tcx
,
exp_map2
,
reachable
,
name
,
..
}
=
analysis
;
let
krate
=
tcx
.map
.krate
();
// Before we touch LLVM, make sure that multithreading is enabled.
...
...
src/librustc_trans/trans/common.rs
浏览文件 @
e135fa5b
...
...
@@ -272,11 +272,6 @@ pub fn arg_pos(&self, arg: uint) -> uint {
}
}
pub
fn
out_arg_pos
(
&
self
)
->
uint
{
assert
!
(
self
.caller_expects_out_pointer
);
0u
}
pub
fn
env_arg_pos
(
&
self
)
->
uint
{
if
self
.caller_expects_out_pointer
{
1u
...
...
src/librustc_trans/trans/context.rs
浏览文件 @
e135fa5b
...
...
@@ -347,10 +347,6 @@ pub fn link_meta<'a>(&'a self) -> &'a LinkMeta {
&
self
.link_meta
}
pub
fn
symbol_hasher
<
'a
>
(
&
'a
self
)
->
&
'a
RefCell
<
Sha256
>
{
&
self
.symbol_hasher
}
pub
fn
tcx
<
'a
>
(
&
'a
self
)
->
&
'a
ty
::
ctxt
<
'tcx
>
{
&
self
.tcx
}
...
...
src/librustc_trans/trans/datum.rs
浏览文件 @
e135fa5b
...
...
@@ -352,13 +352,6 @@ pub fn assert_lvalue(self, bcx: Block) -> Datum<'tcx, Lvalue> {
|
_
|
bcx
.sess
()
.bug
(
"assert_lvalue given rvalue"
))
}
/// Asserts that this datum *is* an lvalue and returns it.
pub
fn
assert_rvalue
(
self
,
bcx
:
Block
)
->
Datum
<
'tcx
,
Rvalue
>
{
self
.match_kind
(
|
_
|
bcx
.sess
()
.bug
(
"assert_rvalue given lvalue"
),
|
r
|
r
)
}
pub
fn
store_to_dest
<
'blk
>
(
self
,
bcx
:
Block
<
'blk
,
'tcx
>
,
dest
:
expr
::
Dest
,
...
...
src/librustc_trans/trans/mod.rs
浏览文件 @
e135fa5b
...
...
@@ -8,40 +8,64 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub
mod
doc
;
pub
mod
macros
;
pub
mod
inline
;
pub
mod
monomorphize
;
pub
mod
controlflow
;
pub
mod
glue
;
pub
mod
datum
;
pub
mod
callee
;
pub
mod
expr
;
pub
mod
common
;
pub
mod
context
;
pub
mod
consts
;
pub
mod
type_of
;
pub
mod
build
;
pub
mod
builder
;
pub
mod
base
;
pub
mod
_
match
;
pub
mod
closure
;
pub
mod
tvec
;
pub
mod
meth
;
pub
mod
cabi
;
pub
mod
cabi_x86
;
pub
mod
cabi_x86_64
;
pub
mod
cabi_x86_win64
;
pub
mod
cabi_arm
;
pub
mod
cabi_mips
;
pub
mod
foreign
;
pub
mod
intrinsic
;
pub
mod
debuginfo
;
pub
mod
machine
;
pub
mod
adt
;
pub
mod
asm
;
pub
mod
type_
;
pub
mod
value
;
pub
mod
basic_block
;
pub
mod
llrepr
;
pub
mod
cleanup
;
use
llvm
::{
ContextRef
,
ModuleRef
};
use
metadata
::
common
::
LinkMeta
;
use
middle
::
dependency_format
;
pub
use
self
::
base
::
trans_crate
;
pub
use
self
::
context
::
CrateContext
;
pub
use
self
::
common
::
gensym_name
;
mod
doc
;
mod
macros
;
mod
inline
;
mod
monomorphize
;
mod
controlflow
;
mod
glue
;
mod
datum
;
mod
callee
;
mod
expr
;
mod
common
;
mod
context
;
mod
consts
;
mod
type_of
;
mod
build
;
mod
builder
;
mod
base
;
mod
_
match
;
mod
closure
;
mod
tvec
;
mod
meth
;
mod
cabi
;
mod
cabi_x86
;
mod
cabi_x86_64
;
mod
cabi_x86_win64
;
mod
cabi_arm
;
mod
cabi_mips
;
mod
foreign
;
mod
intrinsic
;
mod
debuginfo
;
mod
machine
;
mod
adt
;
mod
asm
;
mod
type_
;
mod
value
;
mod
basic_block
;
mod
llrepr
;
mod
cleanup
;
pub
struct
ModuleTranslation
{
pub
llcx
:
ContextRef
,
pub
llmod
:
ModuleRef
,
}
pub
struct
CrateTranslation
{
pub
modules
:
Vec
<
ModuleTranslation
>
,
pub
metadata_module
:
ModuleTranslation
,
pub
link
:
LinkMeta
,
pub
metadata
:
Vec
<
u8
>
,
pub
reachable
:
Vec
<
String
>
,
pub
crate_formats
:
dependency_format
::
Dependencies
,
pub
no_builtins
:
bool
,
}
src/librustdoc/clean/mod.rs
浏览文件 @
e135fa5b
...
...
@@ -39,7 +39,6 @@
use
syntax
::
ptr
::
P
;
use
rustc_trans
::
back
::
link
;
use
rustc_trans
::
driver
::
driver
;
use
rustc
::
metadata
::
cstore
;
use
rustc
::
metadata
::
csearch
;
use
rustc
::
metadata
::
decoder
;
...
...
@@ -48,6 +47,7 @@
use
rustc
::
middle
::
subst
::
VecPerParamSpace
;
use
rustc
::
middle
::
ty
;
use
rustc
::
middle
::
stability
;
use
rustc
::
session
::
config
;
use
std
::
rc
::
Rc
;
use
std
::
u32
;
...
...
@@ -131,7 +131,7 @@ fn clean(&self, cx: &DocContext) -> Crate {
externs
.sort_by
(|
&
(
a
,
_
),
&
(
b
,
_
)|
a
.cmp
(
&
b
));
// Figure out the name of this crate
let
input
=
driver
::
FileInput
(
cx
.src
.clone
());
let
input
=
config
::
Input
::
File
(
cx
.src
.clone
());
let
name
=
link
::
find_crate_name
(
None
,
self
.attrs
.as_slice
(),
&
input
);
// Clean the crate, translating the entire libsyntax AST to one that is
...
...
src/librustdoc/core.rs
浏览文件 @
e135fa5b
...
...
@@ -83,7 +83,7 @@ pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
// Parse, resolve, and typecheck the given crate.
let
input
=
driver
::
FileInput
(
cpath
.clone
());
let
input
=
config
::
Input
::
File
(
cpath
.clone
());
let
warning_lint
=
lint
::
builtin
::
WARNINGS
.name_lower
();
...
...
@@ -122,7 +122,7 @@ pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
let
ast_map
=
driver
::
assign_node_ids_and_map
(
&
sess
,
&
mut
forest
);
let
type_arena
=
TypedArena
::
new
();
let
driver
::
CrateAnalysis
{
let
ty
::
CrateAnalysis
{
exported_items
,
public_items
,
ty_cx
,
..
}
=
driver
::
phase_3_run_analysis_passes
(
sess
,
ast_map
,
&
type_arena
,
name
);
...
...
src/librustdoc/test.rs
浏览文件 @
e135fa5b
...
...
@@ -42,7 +42,7 @@ pub fn run(input: &str,
crate_name
:
Option
<
String
>
)
->
int
{
let
input_path
=
Path
::
new
(
input
);
let
input
=
driver
::
FileInput
(
input_path
.clone
());
let
input
=
config
::
Input
::
File
(
input_path
.clone
());
let
sessopts
=
config
::
Options
{
maybe_sysroot
:
Some
(
os
::
self_exe_path
()
.unwrap
()
.dir_path
()),
...
...
@@ -110,7 +110,7 @@ fn runtest(test: &str, cratename: &str, libs: Vec<Path>, externs: core::Externs,
// the test harness wants its own `main` & top level functions, so
// never wrap the test in `fn main() { ... }`
let
test
=
maketest
(
test
,
Some
(
cratename
),
true
,
as_test_harness
);
let
input
=
driver
::
StrInput
(
test
.to_string
());
let
input
=
config
::
Input
::
Str
(
test
.to_string
());
let
sessopts
=
config
::
Options
{
maybe_sysroot
:
Some
(
os
::
self_exe_path
()
.unwrap
()
.dir_path
()),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录