summaryrefslogtreecommitdiff
path: root/src/mir/cleanup.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-05-05 12:42:57 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-05-05 12:42:57 +0800
commit4c4a7b88914861b644ec56738ced8cfc179f93f9 (patch)
treeb5ab0e30b67698c4d72b224e6b695672966aaeac /src/mir/cleanup.cpp
parenta67c91329da4e2840ee4089e5c7854f68bb8afda (diff)
downloadmrust-4c4a7b88914861b644ec56738ced8cfc179f93f9.tar.gz
MIR - Wrap HIR::Path-s in MIR::Constant in unique_ptr
Diffstat (limited to 'src/mir/cleanup.cpp')
-rw-r--r--src/mir/cleanup.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mir/cleanup.cpp b/src/mir/cleanup.cpp
index fdc0f3d4..dd5332b6 100644
--- a/src/mir/cleanup.cpp
+++ b/src/mir/cleanup.cpp
@@ -216,7 +216,7 @@ const ::HIR::Literal* MIR_Cleanup_GetConstant(const MIR::TypeResolve& state, con
if( path == ::HIR::GenericPath() )
MIR_TODO(state, "Literal of type " << ty << " - " << lit);
DEBUG("Unknown type " << ty << ", but a path was provided - Return ItemAddr " << path);
- return ::MIR::Constant( mv$(path) );
+ return ::MIR::Constant::make_ItemAddr( box$(path) );
),
(Tuple,
MIR_ASSERT(state, lit.is_List(), "Non-list literal for Tuple - " << lit);
@@ -378,7 +378,7 @@ const ::HIR::Literal* MIR_Cleanup_GetConstant(const MIR::TypeResolve& state, con
if( const auto* pp = lit.opt_BorrowPath() )
{
const auto& path = *pp;
- auto ptr_val = ::MIR::Constant::make_ItemAddr(path.clone());
+ auto ptr_val = ::MIR::Constant::make_ItemAddr(box$(path.clone()));
// TODO: Get the metadata type (for !Sized wrapper types)
if( te.inner->m_data.is_Slice() )
{
@@ -397,7 +397,7 @@ const ::HIR::Literal* MIR_Cleanup_GetConstant(const MIR::TypeResolve& state, con
auto vtable_path = ::HIR::Path(&ty == &tmp ? mv$(tmp) : ty.clone(), tep->m_trait.m_path.clone(), "vtable#");
- auto vtable_val = ::MIR::Param( ::MIR::Constant::make_ItemAddr(mv$(vtable_path)) );
+ auto vtable_val = ::MIR::Param( ::MIR::Constant::make_ItemAddr(box$(vtable_path)) );
return ::MIR::RValue::make_MakeDst({ ::MIR::Param(mv$(ptr_val)), mv$(vtable_val) });
}
@@ -458,7 +458,7 @@ const ::HIR::Literal* MIR_Cleanup_GetConstant(const MIR::TypeResolve& state, con
(Function,
//MIR_TODO(state, "Const function pointer " << lit << " w/ type " << ty);
MIR_ASSERT(state, lit.is_BorrowPath(), "");
- return ::MIR::Constant::make_ItemAddr( lit.as_BorrowPath().clone() );
+ return ::MIR::Constant::make_ItemAddr( box$( lit.as_BorrowPath().clone() ) );
)
)
}
@@ -703,7 +703,7 @@ bool MIR_Cleanup_Unsize_GetMetadata(const ::MIR::TypeResolve& state, MirMutator&
MIR_ASSERT(state, state.m_resolve.type_is_sized(state.sp, src_ty), "Attempting to get vtable for unsized type - " << src_ty);
::HIR::Path vtable { src_ty.clone(), trait_path.m_path.clone(), "vtable#" };
- out_meta_val = ::MIR::Constant::make_ItemAddr(mv$(vtable));
+ out_meta_val = ::MIR::Constant::make_ItemAddr(box$(vtable));
}
}
return true;
@@ -1092,18 +1092,18 @@ void MIR_Cleanup(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path,
TU_IFLET( ::MIR::Constant, e, Const, ce,
// 1. Find the constant
::HIR::TypeRef ty;
- const auto* lit_ptr = MIR_Cleanup_GetConstant(state, ce.p, ty);
+ const auto* lit_ptr = MIR_Cleanup_GetConstant(state, *ce.p, ty);
if( lit_ptr && !lit_ptr->is_Defer() )
{
- DEBUG("Replace constant " << ce.p << " with " << *lit_ptr);
- se.src = MIR_Cleanup_LiteralToRValue(state, mutator, *lit_ptr, mv$(ty), mv$(ce.p));
+ DEBUG("Replace constant " << *ce.p << " with " << *lit_ptr);
+ se.src = MIR_Cleanup_LiteralToRValue(state, mutator, *lit_ptr, mv$(ty), mv$(*ce.p));
if( auto* p = se.src.opt_Constant() ) {
MIR_Cleanup_Constant(state, mutator, *p);
}
}
else
{
- DEBUG("No replacement for constant " << ce.p);
+ DEBUG("No replacement for constant " << *ce.p);
}
)
)