[clang] [MC/DC] Refactor MCDC::State::Decision. NFC. (PR #125408)

Jessica Paquette via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 6 21:19:00 PST 2025


================
@@ -30,8 +32,20 @@ struct State {
   unsigned BitmapBits = 0;
 
   struct Decision {
+    using IndicesTy = llvm::SmallVector<std::array<int, 2>>;
+    static constexpr auto InvalidID = std::numeric_limits<unsigned>::max();
+
     unsigned BitmapIdx;
-    llvm::SmallVector<std::array<int, 2>> Indices;
+    IndicesTy Indices;
+    unsigned ID = InvalidID;
+
+    bool isValid() const { return ID != InvalidID; }
+
+    void update(unsigned I, IndicesTy &&X) {
+      assert(ID != InvalidID);
----------------
ornata wrote:

Also, how expensive is this? Would it make sense for this to be a real error in release builds as well?

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


More information about the cfe-commits mailing list