This is an archive of the discontinued LLVM Phabricator instance.

[Coverage] Fix an issue where a coverage region might not be created for a macro containing for or while statements.
ClosedPublic

Authored by ikudrin on Apr 29 2016, 8:48 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ikudrin updated this revision to Diff 55602.Apr 29 2016, 8:48 AM
ikudrin retitled this revision from to [Coverage] Fix an issue where a coverage region might not be created for a macro containing for or while statements..
ikudrin updated this object.
ikudrin added reviewers: bogner, davidxl, vsk.
ikudrin added a subscriber: cfe-commits.
vsk edited edge metadata.Apr 29 2016, 11:18 AM

Thanks, lgtm with a nit.

lib/CodeGen/CoverageMappingGen.cpp
452 ↗(On Diff #55602)

These asserts replicate checks inside of get{Start,End}Loc, so I think it's cleaner to drop them.

davidxl accepted this revision.May 1 2016, 12:21 AM
davidxl edited edge metadata.

lgtm

lib/CodeGen/CoverageMappingGen.cpp
468 ↗(On Diff #55602)

Perhaps add a comment here that there is need to create 'outer most' code region for while/for stmt('s virtual file) with counter equal to the parent/enclosing scope's counter. The expansion region's counter will be copied from it during coverage reading. Also refer to handleFileExit where the region is created.

This revision is now accepted and ready to land.May 1 2016, 12:21 AM
ikudrin added inline comments.May 4 2016, 5:45 AM
lib/CodeGen/CoverageMappingGen.cpp
468 ↗(On Diff #55602)

We don't copy the outer code region's counter into an expansion region anymore. It was in the previous revision of D18831, but, with this patch, it's no longer needed. I'll refer to handleFileExit(), though.

This revision was automatically updated to reflect the committed changes.