Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d78b33a8
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,发现更多精彩内容 >>
提交
d78b33a8
编写于
9月 03, 2019
作者:
N
Nicholas Nethercote
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove `LocalInternedString` uses from `librustc_codegen_llvm`.
上级
b50db34e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
20 deletion
+20
-20
src/librustc_codegen_llvm/builder.rs
src/librustc_codegen_llvm/builder.rs
+3
-3
src/librustc_codegen_llvm/common.rs
src/librustc_codegen_llvm/common.rs
+7
-6
src/librustc_codegen_llvm/context.rs
src/librustc_codegen_llvm/context.rs
+2
-2
src/librustc_codegen_ssa/mir/block.rs
src/librustc_codegen_ssa/mir/block.rs
+5
-6
src/librustc_codegen_ssa/traits/statics.rs
src/librustc_codegen_ssa/traits/statics.rs
+3
-3
未找到文件。
src/librustc_codegen_llvm/builder.rs
浏览文件 @
d78b33a8
...
...
@@ -5,7 +5,6 @@
use
crate
::
type_
::
Type
;
use
crate
::
type_of
::
LayoutLlvmExt
;
use
crate
::
value
::
Value
;
use
syntax
::
symbol
::
LocalInternedString
;
use
rustc_codegen_ssa
::
common
::{
IntPredicate
,
TypeKind
,
RealPredicate
};
use
rustc_codegen_ssa
::
MemFlags
;
use
libc
::{
c_uint
,
c_char
};
...
...
@@ -24,6 +23,7 @@
use
std
::
ops
::{
Deref
,
Range
};
use
std
::
ptr
;
use
std
::
iter
::
TrustedLen
;
use
syntax
::
symbol
::
Symbol
;
// All Builders must have an llfn associated with them
#[must_use]
...
...
@@ -1082,8 +1082,8 @@ fn get_static(&mut self, def_id: DefId) -> &'ll Value {
fn
static_panic_msg
(
&
mut
self
,
msg
:
Option
<
LocalInternedString
>
,
filename
:
LocalInternedString
,
msg
:
Option
<
Symbol
>
,
filename
:
Symbol
,
line
:
Self
::
Value
,
col
:
Self
::
Value
,
kind
:
&
str
,
...
...
src/librustc_codegen_llvm/common.rs
浏览文件 @
d78b33a8
...
...
@@ -17,7 +17,7 @@
use
libc
::{
c_uint
,
c_char
};
use
syntax
::
symbol
::
LocalInternedString
;
use
syntax
::
symbol
::
Symbol
;
use
syntax
::
ast
::
Mutability
;
pub
use
crate
::
context
::
CodegenCx
;
...
...
@@ -122,7 +122,7 @@ pub fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
fn
const_cstr
(
&
self
,
s
:
LocalInternedString
,
s
:
Symbol
,
null_terminated
:
bool
,
)
->
&
'll
Value
{
unsafe
{
...
...
@@ -130,9 +130,10 @@ fn const_cstr(
return
llval
;
}
let
s_str
=
s
.as_str
();
let
sc
=
llvm
::
LLVMConstStringInContext
(
self
.llcx
,
s
.as_ptr
()
as
*
const
c_char
,
s
.len
()
as
c_uint
,
s
_str
.as_ptr
()
as
*
const
c_char
,
s
_str
.len
()
as
c_uint
,
!
null_terminated
as
Bool
);
let
sym
=
self
.generate_local_symbol_name
(
"str"
);
let
g
=
self
.define_global
(
&
sym
[
..
],
self
.val_ty
(
sc
))
.unwrap_or_else
(||{
...
...
@@ -147,8 +148,8 @@ fn const_cstr(
}
}
pub
fn
const_str_slice
(
&
self
,
s
:
LocalInternedString
)
->
&
'll
Value
{
let
len
=
s
.len
();
pub
fn
const_str_slice
(
&
self
,
s
:
Symbol
)
->
&
'll
Value
{
let
len
=
s
.
as_str
()
.
len
();
let
cs
=
consts
::
ptrcast
(
self
.const_cstr
(
s
,
false
),
self
.type_ptr_to
(
self
.layout_of
(
self
.tcx
.mk_str
())
.llvm_type
(
self
)));
self
.const_fat_ptr
(
cs
,
self
.const_usize
(
len
as
u64
))
...
...
src/librustc_codegen_llvm/context.rs
浏览文件 @
d78b33a8
...
...
@@ -29,7 +29,7 @@
use
std
::
iter
;
use
std
::
str
;
use
std
::
sync
::
Arc
;
use
syntax
::
symbol
::
LocalInternedString
;
use
syntax
::
symbol
::
Symbol
;
use
syntax
::
source_map
::{
DUMMY_SP
,
Span
};
use
crate
::
abi
::
Abi
;
...
...
@@ -52,7 +52,7 @@ pub struct CodegenCx<'ll, 'tcx> {
pub
vtables
:
RefCell
<
FxHashMap
<
(
Ty
<
'tcx
>
,
Option
<
ty
::
PolyExistentialTraitRef
<
'tcx
>>
),
&
'll
Value
>>
,
/// Cache of constant strings,
pub
const_cstr_cache
:
RefCell
<
FxHashMap
<
LocalInternedString
,
&
'll
Value
>>
,
pub
const_cstr_cache
:
RefCell
<
FxHashMap
<
Symbol
,
&
'll
Value
>>
,
/// Reverse-direction for const ptrs cast from globals.
/// Key is a Value holding a *T,
...
...
src/librustc_codegen_ssa/mir/block.rs
浏览文件 @
d78b33a8
...
...
@@ -14,7 +14,7 @@
use
std
::
borrow
::
Cow
;
use
syntax
::
symbol
::
LocalInternedString
;
use
syntax
::
symbol
::
Symbol
;
use
syntax_pos
::
Pos
;
use
super
::{
FunctionCx
,
LocalRef
};
...
...
@@ -397,7 +397,7 @@ fn codegen_assert_terminator<'b>(
// Get the location information.
let
loc
=
bx
.sess
()
.source_map
()
.lookup_char_pos
(
span
.lo
());
let
filename
=
LocalInternedString
::
intern
(
&
loc
.file.name
.to_string
());
let
filename
=
Symbol
::
intern
(
&
loc
.file.name
.to_string
());
let
line
=
bx
.const_u32
(
loc
.line
as
u32
);
let
col
=
bx
.const_u32
(
loc
.col
.to_usize
()
as
u32
+
1
);
...
...
@@ -418,8 +418,7 @@ fn codegen_assert_terminator<'b>(
vec!
[
file_line_col
,
index
,
len
])
}
_
=>
{
let
str
=
msg
.description
();
let
msg_str
=
LocalInternedString
::
intern
(
str
);
let
msg_str
=
Symbol
::
intern
(
msg
.description
());
let
msg_file_line_col
=
bx
.static_panic_msg
(
Some
(
msg_str
),
filename
,
...
...
@@ -531,7 +530,7 @@ fn codegen_call_terminator<'b>(
let
layout
=
bx
.layout_of
(
ty
);
if
layout
.abi
.is_uninhabited
()
{
let
loc
=
bx
.sess
()
.source_map
()
.lookup_char_pos
(
span
.lo
());
let
filename
=
LocalInternedString
::
intern
(
&
loc
.file.name
.to_string
());
let
filename
=
Symbol
::
intern
(
&
loc
.file.name
.to_string
());
let
line
=
bx
.const_u32
(
loc
.line
as
u32
);
let
col
=
bx
.const_u32
(
loc
.col
.to_usize
()
as
u32
+
1
);
...
...
@@ -539,7 +538,7 @@ fn codegen_call_terminator<'b>(
"Attempted to instantiate uninhabited type {}"
,
ty
);
let
msg_str
=
LocalInternedString
::
intern
(
&
str
);
let
msg_str
=
Symbol
::
intern
(
&
str
);
let
msg_file_line_col
=
bx
.static_panic_msg
(
Some
(
msg_str
),
filename
,
...
...
src/librustc_codegen_ssa/traits/statics.rs
浏览文件 @
d78b33a8
use
super
::
BackendTypes
;
use
syntax_pos
::
symbol
::
LocalInternedString
;
use
syntax_pos
::
symbol
::
Symbol
;
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
ty
::
layout
::
Align
;
...
...
@@ -12,8 +12,8 @@ pub trait StaticBuilderMethods: BackendTypes {
fn
get_static
(
&
mut
self
,
def_id
:
DefId
)
->
Self
::
Value
;
fn
static_panic_msg
(
&
mut
self
,
msg
:
Option
<
LocalInternedString
>
,
filename
:
LocalInternedString
,
msg
:
Option
<
Symbol
>
,
filename
:
Symbol
,
line
:
Self
::
Value
,
col
:
Self
::
Value
,
kind
:
&
str
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录