The functions lookForDIEsToKeep and keepDIEAndDependencies are mutually
recursive and can cause a stackoverflow for large projects. While this has
always been the case, it became a bigger issue when we parallelized dsymutil,
because threads get only a fraction of the stack space.
In an attempt to tackle this issue, we removed part of the recursion in r338536
by introducing a worklist. Processing of child DIEs was no longer recursive.
However, we still received bug reports where we'd run out of stack space.
This patch removes another recursive call from lookForDIEsToKeep. The call was
used to look at DIEs that reference the current DIE. To make this possible, we
inlined keepDIEAndDependencies and added this work to the existing worklist.
Because the function is not tail recursive, we needed to add two more types of
worklist entries to perform the subsequent work.
Although one more recursive call remains, this was sufficient to address the
stack space issue for our current reports.
///