[llvm] CoverageMappingWriter: Emit `Decision` before `Expansion` (PR #78966)
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 19:57:53 PST 2024
================
@@ -167,7 +167,18 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
return LHS.FileID < RHS.FileID;
if (LHS.startLoc() != RHS.startLoc())
return LHS.startLoc() < RHS.startLoc();
- return LHS.Kind < RHS.Kind;
+
+ // Put `Decision` before `Expansion`.
+ auto getKindKey = [](CounterMappingRegion::RegionKind Kind) {
+ return (Kind == CounterMappingRegion::MCDCDecisionRegion
+ ? 2 * CounterMappingRegion::ExpansionRegion - 1
+ : 2 * Kind);
+ };
+
+ auto LHSKindKey = getKindKey(LHS.Kind);
----------------
ornata wrote:
These variables are only used in line 181. Therefore, we can simplify this.
```
return getKindKey(LHS.Kind) < getKindKey(RHS.Kind);
```
https://github.com/llvm/llvm-project/pull/78966
More information about the llvm-commits
mailing list