@@ -95,9 +95,6 @@ void CoverageSourceInfo::updateNextTokLoc(SourceLocation Loc) {
9595}
9696
9797namespace {
98- using MCDCConditionID = CounterMappingRegion::MCDCConditionID;
99- using MCDCParameters = CounterMappingRegion::MCDCParameters;
100-
10198// / A region of source code that can be mapped to a counter.
10299class SourceMappingRegion {
103100 // / Primary Counter that is also used for Branch Regions for "True" branches.
@@ -107,7 +104,7 @@ class SourceMappingRegion {
107104 std::optional<Counter> FalseCount;
108105
109106 // / Parameters used for Modified Condition/Decision Coverage
110- MCDCParameters MCDCParams;
107+ mcdc::Parameters MCDCParams;
111108
112109 // / The region's starting location.
113110 std::optional<SourceLocation> LocStart;
@@ -131,15 +128,15 @@ class SourceMappingRegion {
131128 SkippedRegion (false ) {}
132129
133130 SourceMappingRegion (Counter Count, std::optional<Counter> FalseCount,
134- MCDCParameters MCDCParams,
131+ mcdc::Parameters MCDCParams,
135132 std::optional<SourceLocation> LocStart,
136133 std::optional<SourceLocation> LocEnd,
137134 bool GapRegion = false )
138135 : Count(Count), FalseCount(FalseCount), MCDCParams(MCDCParams),
139136 LocStart(LocStart), LocEnd(LocEnd), GapRegion(GapRegion),
140137 SkippedRegion(false ) {}
141138
142- SourceMappingRegion (MCDCParameters MCDCParams,
139+ SourceMappingRegion (mcdc::Parameters MCDCParams,
143140 std::optional<SourceLocation> LocStart,
144141 std::optional<SourceLocation> LocEnd)
145142 : MCDCParams(MCDCParams), LocStart(LocStart), LocEnd(LocEnd),
@@ -187,7 +184,7 @@ class SourceMappingRegion {
187184
188185 bool isMCDCDecision () const { return MCDCParams.NumConditions != 0 ; }
189186
190- const MCDCParameters &getMCDCParams () const { return MCDCParams; }
187+ const mcdc::Parameters &getMCDCParams () const { return MCDCParams; }
191188};
192189
193190// / Spelling locations for the start and end of a source region.
@@ -587,8 +584,8 @@ struct EmptyCoverageMappingBuilder : public CoverageMappingBuilder {
587584struct MCDCCoverageBuilder {
588585
589586 struct DecisionIDPair {
590- MCDCConditionID TrueID = 0 ;
591- MCDCConditionID FalseID = 0 ;
587+ mcdc::ConditionID TrueID = 0 ;
588+ mcdc::ConditionID FalseID = 0 ;
592589 };
593590
594591 // / The AST walk recursively visits nested logical-AND or logical-OR binary
@@ -682,9 +679,9 @@ struct MCDCCoverageBuilder {
682679 CodeGenModule &CGM;
683680
684681 llvm::SmallVector<DecisionIDPair> DecisionStack;
685- llvm::DenseMap<const Stmt *, MCDCConditionID > &CondIDs;
682+ llvm::DenseMap<const Stmt *, mcdc::ConditionID > &CondIDs;
686683 llvm::DenseMap<const Stmt *, unsigned > &MCDCBitmapMap;
687- MCDCConditionID NextID = 1 ;
684+ mcdc::ConditionID NextID = 1 ;
688685 bool NotMapped = false ;
689686
690687 // / Represent a sentinel value of [0,0] for the bottom of DecisionStack.
@@ -696,9 +693,10 @@ struct MCDCCoverageBuilder {
696693 }
697694
698695public:
699- MCDCCoverageBuilder (CodeGenModule &CGM,
700- llvm::DenseMap<const Stmt *, MCDCConditionID> &CondIDMap,
701- llvm::DenseMap<const Stmt *, unsigned > &MCDCBitmapMap)
696+ MCDCCoverageBuilder (
697+ CodeGenModule &CGM,
698+ llvm::DenseMap<const Stmt *, mcdc::ConditionID> &CondIDMap,
699+ llvm::DenseMap<const Stmt *, unsigned > &MCDCBitmapMap)
702700 : CGM(CGM), DecisionStack(1 , DecisionStackSentinel), CondIDs(CondIDMap),
703701 MCDCBitmapMap (MCDCBitmapMap) {}
704702
@@ -713,12 +711,12 @@ struct MCDCCoverageBuilder {
713711 bool isBuilding () const { return (NextID > 1 ); }
714712
715713 // / Set the given condition's ID.
716- void setCondID (const Expr *Cond, MCDCConditionID ID) {
714+ void setCondID (const Expr *Cond, mcdc::ConditionID ID) {
717715 CondIDs[CodeGenFunction::stripCond (Cond)] = ID;
718716 }
719717
720718 // / Return the ID of a given condition.
721- MCDCConditionID getCondID (const Expr *Cond) const {
719+ mcdc::ConditionID getCondID (const Expr *Cond) const {
722720 auto I = CondIDs.find (CodeGenFunction::stripCond (Cond));
723721 if (I == CondIDs.end ())
724722 return 0 ;
@@ -755,7 +753,7 @@ struct MCDCCoverageBuilder {
755753 setCondID (E->getLHS (), NextID++);
756754
757755 // Assign a ID+1 for the RHS.
758- MCDCConditionID RHSid = NextID++;
756+ mcdc::ConditionID RHSid = NextID++;
759757 setCondID (E->getRHS (), RHSid);
760758
761759 // Push the LHS decision IDs onto the DecisionStack.
@@ -865,8 +863,8 @@ struct CounterCoverageMappingBuilder
865863 std::optional<SourceLocation> StartLoc = std::nullopt ,
866864 std::optional<SourceLocation> EndLoc = std::nullopt ,
867865 std::optional<Counter> FalseCount = std::nullopt ,
868- MCDCConditionID ID = 0 , MCDCConditionID TrueID = 0 ,
869- MCDCConditionID FalseID = 0 ) {
866+ mcdc::ConditionID ID = 0 , mcdc::ConditionID TrueID = 0 ,
867+ mcdc::ConditionID FalseID = 0 ) {
870868
871869 if (StartLoc && !FalseCount) {
872870 MostRecentLocation = *StartLoc;
@@ -886,7 +884,7 @@ struct CounterCoverageMappingBuilder
886884 if (EndLoc && EndLoc->isInvalid ())
887885 EndLoc = std::nullopt ;
888886 RegionStack.emplace_back (Count, FalseCount,
889- MCDCParameters {0 , 0 , ID, TrueID, FalseID},
887+ mcdc::Parameters {0 , 0 , ID, TrueID, FalseID},
890888 StartLoc, EndLoc);
891889
892890 return RegionStack.size () - 1 ;
@@ -896,7 +894,7 @@ struct CounterCoverageMappingBuilder
896894 std::optional<SourceLocation> StartLoc = std::nullopt ,
897895 std::optional<SourceLocation> EndLoc = std::nullopt ) {
898896
899- RegionStack.emplace_back (MCDCParameters {BitmapIdx, Conditions}, StartLoc,
897+ RegionStack.emplace_back (mcdc::Parameters {BitmapIdx, Conditions}, StartLoc,
900898 EndLoc);
901899
902900 return RegionStack.size () - 1 ;
@@ -1042,9 +1040,9 @@ struct CounterCoverageMappingBuilder
10421040 // function's SourceRegions) because it doesn't apply to any other source
10431041 // code other than the Condition.
10441042 if (CodeGenFunction::isInstrumentedCondition (C)) {
1045- MCDCConditionID ID = MCDCBuilder.getCondID (C);
1046- MCDCConditionID TrueID = IDPair.TrueID ;
1047- MCDCConditionID FalseID = IDPair.FalseID ;
1043+ mcdc::ConditionID ID = MCDCBuilder.getCondID (C);
1044+ mcdc::ConditionID TrueID = IDPair.TrueID ;
1045+ mcdc::ConditionID FalseID = IDPair.FalseID ;
10481046
10491047 // If a condition can fold to true or false, the corresponding branch
10501048 // will be removed. Create a region with both counters hard-coded to
@@ -1151,9 +1149,9 @@ struct CounterCoverageMappingBuilder
11511149 if (I.isBranch ())
11521150 SourceRegions.emplace_back (
11531151 I.getCounter (), I.getFalseCounter (),
1154- MCDCParameters {0 , 0 , I.getMCDCParams ().ID ,
1155- I.getMCDCParams ().TrueID ,
1156- I.getMCDCParams ().FalseID },
1152+ mcdc::Parameters {0 , 0 , I.getMCDCParams ().ID ,
1153+ I.getMCDCParams ().TrueID ,
1154+ I.getMCDCParams ().FalseID },
11571155 Loc, getEndOfFileOrMacro (Loc), I.isBranch ());
11581156 else
11591157 SourceRegions.emplace_back (I.getCounter (), Loc,
@@ -1338,7 +1336,7 @@ struct CounterCoverageMappingBuilder
13381336 CoverageMappingModuleGen &CVM,
13391337 llvm::DenseMap<const Stmt *, unsigned > &CounterMap,
13401338 llvm::DenseMap<const Stmt *, unsigned > &MCDCBitmapMap,
1341- llvm::DenseMap<const Stmt *, MCDCConditionID > &CondIDMap,
1339+ llvm::DenseMap<const Stmt *, mcdc::ConditionID > &CondIDMap,
13421340 SourceManager &SM, const LangOptions &LangOpts)
13431341 : CoverageMappingBuilder(CVM, SM, LangOpts), CounterMap(CounterMap),
13441342 MCDCBitmapMap (MCDCBitmapMap),
0 commit comments