MC/DC in LLVM Source-based Code Coverage: Review 3/3
Background
I previously upstreamed work to enable Branch Coverage (https://reviews.llvm.org/D84467), which was pushed in early 2021. MC/DC (Modified Condition/Decision Coverage) is a planned enhancement to Source-based Code Coverage. Implementation was completed in May for our downstream Arm compiler, and in general use it has not yielded any issues.
Patches have been tested on windows (stage1) and linux/mac (stage1 and stage2). Fuchsia is not yet supported.
See attached file for Background, Motivation, Design, and Implementation Concepts:
See attached PDF for Technical Talk slides from 2022 LLVM Developers' Meeting:
I am also available at Discord @alanphipps
Review
This review is for the clang front-end components.
Start with the front-end changes:
- New Option and common parameters
- CodeGenOptions.def
- Options.td
- Clang.cpp
- Bitmap Coverage Object Allocation:
- CodeGenPGO.h, CodeGenPGO.cpp
- Source Region Mapping:
- CoverageMappingGen.h, CoverageMappingGen.cpp
- Instrumentation (during IR lowering):
- CGExprScalar.cpp
- CGStmt.cpp
- CodeGenFunction.h, CodeGenFunction.cpp
Looks like there's no way to set MCDCMaxConditionCount, in which case perhaps it's best to omit the option for now.