Page MenuHomePhabricator

[Coverage] Load code coverage data from archives

Authored by vsk on Jun 12 2019, 3:49 PM.



Support loading code coverage data from regular archives, thin archives,
and from MachO universal binaries which contain archives.

Testing: check-llvm, check-profile (with {A,UB}San enabled)


Diff Detail


Event Timeline

vsk created this revision.Jun 12 2019, 3:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2019, 3:49 PM
Dor1s accepted this revision.Jun 13 2019, 8:44 AM

Left some questions / suggestions, but don't see any problems, LGTM!

595 ↗(On Diff #204377)

nit: I guess it's stupid, but maybe sizeof(uint32_t) isntead of 4? And the same in the following conditions.

597 ↗(On Diff #204377)

I think we can make it a bit more concise (2 branches instead of 4) by passing Endian as a template parameter. May need a separate check though to make sure it's either support::endianness::little or support::endianness::big.

742 ↗(On Diff #204377)

Why do we use emplace_back here and on line 794, but push_back in the other places?

757 ↗(On Diff #204377)

Should we log anything here?

This revision is now accepted and ready to land.Jun 13 2019, 8:44 AM
vsk updated this revision to Diff 204577.Jun 13 2019, 10:30 AM
vsk marked 2 inline comments as done.
  • Address review feedback.
595 ↗(On Diff #204377)

If it were possible to write 'sizeof(intptr32_t)', I think that would be clearer. I'm not sure 'sizeof(uint32_t)' is clearer than '4', though.

597 ↗(On Diff #204377)

As 'Endian' is not a constant-expression, I don't think it's possible to pass it in as a template parameter. I think it could be passed as a regular parameter, but that would eliminate two branches here while adding two branches to 'readCoverageMappingData'.

742 ↗(On Diff #204377)


757 ↗(On Diff #204377)

I don't think so. It's expected that at least one of the slices in a universal binary will not match the desired architecture. I'll add a comment to that effect.

Dor1s accepted this revision.Jun 13 2019, 10:34 AM

Thanks for the replies, Vedant. Still LGTM!

597 ↗(On Diff #204377)

Ah, good point, my bad!

is thin archive supported?

llvm-cov's user manual probably also needs some update.

vsk updated this revision to Diff 204603.Jun 13 2019, 12:12 PM
vsk edited the summary of this revision. (Show Details)
  • Add support for thin archives (and a test).
  • Update the llvm-cov CommandGuide doc.
davidxl accepted this revision.Jun 13 2019, 1:16 PM


This revision was automatically updated to reflect the committed changes.