There is no call graph or even interesting analysis for this part of
function attributes -- it is literally inferring attributes based on the
target library identification. As such, we can do it using a much
simpler module pass that just walks the declarations. This can also
happen much earlier in the pass pipeline which has benefits for any
number of other passes.
In the process, I've had to clean up several aspects of this logic.
First, the pass now counts inferred attributes independently rather than
just counting all the inferred attributes as one, and the counts are
more clearly explained. Second, the pass infers at least some of the
library functions as norecurse. I've been *exceedingly* conservative
here and only added it for library functions that I could instantly and
confidently make this claim. Things like printf and malloc or any
function which I could imagine some how, even through very strange steps
such as malloc hooks or a recursive printf implementation, I left alone.
This at least allowed me to keep the no-recurse logic in place rather
than having to delete it for being unused just to add it back when we
decide to finish annotating such things. We should go through and be
more aggressive about norecurse I suspect.
The two test cases we had for this code path are both ... woefully
inadequate and copies of each other. I've kept the superset test and
updated it. We need more testing here, but I had to pick somewhere to
stop fixing everything broken I saw here.
Depends on D15668.
Double period.