Currently, clang crashes when there are several CUs with the same module.
It has been probably broken in:
So the goal of the patch is to fix it.
It would help to have a regression test for this (somewhere in test/Transforms/GCOVProfiling). Something that exercises emitProfileArcs with 2 CU's would work.
Here's a starting point:
Note that this actually crashes somewhere in emitProfileNotes. ASan reports a heap buffer overflow.
Very nice simplification, I hope this won't introduce regressions.
I think we should test the patch on Mozilla CI before landing, so we can be reasonably confident that it doesn't break things.
It's a little confusing to have two variable names which are so similar. Maybe call the first CUToGCOVFunctions and the second CUToFunctions?
Nit: Maybe keep the same convention of using this-> for member variables?
There are some formatting changes here and there, did you make them with clang format?
Do we have another test for the case where CUToCounters is not empty? I assume we don't.