removeUnneededCalls() is responsible for removing path diagnostic pieces within functions that don't contain "interesting" events. It is the functionality that's controlled by the `-analyzer-config prune-paths and it makes bug reports much tidier (though sometimes it removes too much, and in this case it's great to disable this option when debugging).
While relatively simple, it contains a bug: when a stack frame is known to be interesting, the function doesn't descend into it to prune anything within it, even other callees that are totally boring.
This is rarely apparent, but in C++ there are a lot of implicit calls that suddenly become visible because of this bug.