提交 8e10c4d5 编写于 作者: M MaulingMonkey

Modify type names on MSVC to make strings and slices .natvis compatible.

上级 5d5e67a9
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="str">
<DisplayString>{data_ptr,[length]}</DisplayString>
<StringView>data_ptr,[length]</StringView>
<Expand>
<Item Name="[size]" ExcludeView="simple">length</Item>
<ArrayItems>
<Size>length</Size>
<ValuePointer>data_ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="slice&lt;*&gt;">
<DisplayString>{{ length={length} }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">length</Item>
<ArrayItems>
<Size>length</Size>
<ValuePointer>data_ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>
......@@ -61,21 +61,27 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
output.push(')');
},
ty::TyRawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => {
output.push('*');
let is_like_msvc = cx.sess().target.target.options.is_like_msvc;
if !is_like_msvc {output.push('*');}
match mutbl {
hir::MutImmutable => output.push_str("const "),
hir::MutMutable => output.push_str("mut "),
}
push_debuginfo_type_name(cx, inner_type, true, output);
if is_like_msvc {output.push('*');}
},
ty::TyRef(_, ty::TypeAndMut { ty: inner_type, mutbl }) => {
output.push('&');
let is_like_msvc = cx.sess().target.target.options.is_like_msvc;
if !is_like_msvc {output.push('&');}
if mutbl == hir::MutMutable {
output.push_str("mut ");
}
push_debuginfo_type_name(cx, inner_type, true, output);
if is_like_msvc {output.push('*');}
},
ty::TyArray(inner_type, len) => {
output.push('[');
......@@ -84,9 +90,10 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
output.push(']');
},
ty::TySlice(inner_type) => {
output.push('[');
let is_like_msvc = cx.sess().target.target.options.is_like_msvc;
output.push_str(if is_like_msvc {"slice<"} else {"["});
push_debuginfo_type_name(cx, inner_type, true, output);
output.push(']');
output.push(if is_like_msvc {'>'} else {']'});
},
ty::TyDynamic(ref trait_data, ..) => {
if let Some(principal) = trait_data.principal() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册