Example #1
0
File: qbc.cpp Project: zhaobr/qbrt
uint32_t label_index(const label_map &lmap, const std::string &lbl)
{
	label_map::const_iterator it(lmap.find(lbl));
	if (it == lmap.end()) {
		cerr << "unknown label: " << lbl << endl;
		return -1;
	}
	return it->second;
}
Example #2
0
 void add_code( perseus::detail::code_segment& out_code, const label_map& labels, const label_reference_offset& reference, Tail... tail )
 {
   auto pos = labels.find( reference.name );
   if( pos == labels.end() )
   {
     throw std::logic_error( "invalid label reference" );
   }
   out_code.push< std::uint32_t >( pos->second - out_code.size() - sizeof( std::uint32_t ) );
   add_code( out_code, labels, tail... );
 }
void map_labels::clear_map(label_map &m, bool force)
{
	label_map::iterator i = m.begin();
	while (i != m.end())
	{
		if (!i->second->immutable() || force) {
			delete i->second;
			m.erase(i++);
		} else ++i;
	}
}