[llvm] [clang] [clang][CoverageMapping] Refactor when setting MC/DC True/False (PR #78202)

NAKAMURA Takumi via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 17:45:15 PST 2024


================
@@ -663,54 +668,40 @@ struct MCDCCoverageBuilder {
 private:
   CodeGenModule &CGM;
 
-  llvm::SmallVector<MCDCConditionID> AndRHS;
-  llvm::SmallVector<MCDCConditionID> OrRHS;
-  llvm::SmallVector<const BinaryOperator *> NestLevel;
+  llvm::SmallVector<DecisionIDPair, 6> DecisionStack;
   llvm::DenseMap<const Stmt *, MCDCConditionID> &CondIDs;
   llvm::DenseMap<const Stmt *, unsigned> &MCDCBitmapMap;
   MCDCConditionID NextID = 1;
   bool NotMapped = false;
 
+  /// Represent a sentinel value of [0,0] for the bottom of DecisionStack.
+  static constexpr DecisionIDPair DecisionIDPairSentinel{0, 0};
----------------
chapuni wrote:

Is "`DecisionStackSentinel`" better?

I think it would be more descriptive to move it onto the definition of `DecisionStack`.

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


More information about the cfe-commits mailing list