[llvm] CoverageMappingWriter: Emit `Decision` before `Expansion` (PR #78966)

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 19:55:58 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
----------------
ornata wrote:

Can you explain why this is multiplied by 2?

https://github.com/llvm/llvm-project/pull/78966


More information about the llvm-commits mailing list