Skip to content

Commit 1782978

Browse files
committed
mcdc-coverage: Update ffi RegionKind to match LLVM's
1 parent 3f791cb commit 1782978

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ pub enum RegionKind {
9999
/// associated with two counters, each representing the number of times the
100100
/// expression evaluates to true or false.
101101
BranchRegion = 4,
102+
103+
/// A DecisionRegion represents a top-level boolean expression and is
104+
/// associated with a variable length bitmap index and condition number.
105+
#[allow(dead_code)]
106+
MCDCDecisionRegion = 5,
107+
108+
/// A Branch Region can be extended to include IDs to facilitate MC/DC.
109+
#[allow(dead_code)]
110+
MCDCBranchRegion = 6,
102111
}
103112

104113
/// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the

compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ enum class LLVMRustCounterMappingRegionKind {
4343
SkippedRegion = 2,
4444
GapRegion = 3,
4545
BranchRegion = 4,
46+
MCDCDecisionRegion = 5,
47+
MCDCBranchRegion = 6,
4648
};
4749

4850
static coverage::CounterMappingRegion::RegionKind
@@ -58,6 +60,10 @@ fromRust(LLVMRustCounterMappingRegionKind Kind) {
5860
return coverage::CounterMappingRegion::GapRegion;
5961
case LLVMRustCounterMappingRegionKind::BranchRegion:
6062
return coverage::CounterMappingRegion::BranchRegion;
63+
case LLVMRustCounterMappingRegionKind::MCDCDecisionRegion:
64+
return coverage::CounterMappingRegion::MCDCDecisionRegion;
65+
case LLVMRustCounterMappingRegionKind::MCDCBranchRegion:
66+
return coverage::CounterMappingRegion::MCDCBranchRegion;
6167
}
6268
report_fatal_error("Bad LLVMRustCounterMappingRegionKind!");
6369
}

0 commit comments

Comments
 (0)