Use std::unique_ptr for DIE children

Got bored, removed some manual memory management.

Pushed references (rather than pointers) through a few APIs rather than
replacing *x with x.get().