summaryrefslogtreecommitdiff
path: root/tools/standalone_miri/module_tree.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-08-17 17:22:50 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-08-17 17:22:50 +0800
commitfdd60793c48493584f6b2b691207a89a618e656d (patch)
treeb0902dc3e02824d4ebfdd3993cf4ea39b800b676 /tools/standalone_miri/module_tree.cpp
parent50278961cc1b355dac83b4e79c8beb2635fd897d (diff)
downloadmrust-fdd60793c48493584f6b2b691207a89a618e656d.tar.gz
Standalone MIRI - Refactor Value to allow one relocation inline
Diffstat (limited to 'tools/standalone_miri/module_tree.cpp')
-rw-r--r--tools/standalone_miri/module_tree.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/standalone_miri/module_tree.cpp b/tools/standalone_miri/module_tree.cpp
index 71a545fa..2d1eb838 100644
--- a/tools/standalone_miri/module_tree.cpp
+++ b/tools/standalone_miri/module_tree.cpp
@@ -152,8 +152,7 @@ bool Parser::parse_one()
Static s;
s.val = Value(ty);
// - Statics need to always have an allocation (for references)
- if( !s.val.allocation )
- s.val.create_allocation();
+ s.val.ensure_allocation();
s.val.write_bytes(0, data.data(), data.size());
s.ty = ty;
@@ -173,14 +172,13 @@ bool Parser::parse_one()
auto reloc_str = ::std::move(lex.consume().strval);
auto a = Allocation::new_alloc( reloc_str.size(), FMT_STRING("static " << p) );
- //a.alloc().set_tag();
a->write_bytes(0, reloc_str.data(), reloc_str.size());
- s.val.allocation->relocations.push_back({ ofs, /*size,*/ RelocationPtr::new_alloc(::std::move(a)) });
+ s.val.set_reloc( ofs, size, RelocationPtr::new_alloc(::std::move(a)) );
}
else if( lex.next() == "::" || lex.next() == "<" )
{
auto reloc_path = parse_path();
- s.val.allocation->relocations.push_back({ ofs, /*size,*/ RelocationPtr::new_fcn(reloc_path) });
+ s.val.set_reloc( ofs, size, RelocationPtr::new_fcn(reloc_path) );
}
else
{