Our printStackSize implementation currently uses
API like RelocationRef, object::symbol_iterator.
It is not ideal as it doesn't allow
to handle possible error conditions properly.
Some time ago I started rewriting it and this NFC patch is
a one more step toward to it. Here I am introducing the
forEachRelocationDo helper. With it it is possible to iterate
over all kinds of relocations, what is helpful for improving
the code it printStackSize and around.
I've made some progress in improving this area and going to post
other related follow-up patches really soon.
It is slightly unfortunate that this cannot use function_ref because the variable used for initialization is local.