| 1 | //===---- MCDCState.h - Per-Function MC/DC state ----------------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Per-Function MC/DC state for PGO |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_CLANG_LIB_CODEGEN_MCDCSTATE_H |
| 14 | #define LLVM_CLANG_LIB_CODEGEN_MCDCSTATE_H |
| 15 | |
| 16 | #include "llvm/ADT/DenseMap.h" |
| 17 | #include "llvm/ADT/SmallVector.h" |
| 18 | #include "llvm/ProfileData/Coverage/MCDCTypes.h" |
| 19 | |
| 20 | namespace clang { |
| 21 | class Stmt; |
| 22 | } // namespace clang |
| 23 | |
| 24 | namespace clang::CodeGen::MCDC { |
| 25 | |
| 26 | using namespace llvm::coverage::mcdc; |
| 27 | |
| 28 | /// Per-Function MC/DC state |
| 29 | struct State { |
| 30 | unsigned BitmapBits = 0; |
| 31 | |
| 32 | struct Decision { |
| 33 | unsigned BitmapIdx; |
| 34 | llvm::SmallVector<std::array<int, 2>> Indices; |
| 35 | }; |
| 36 | |
| 37 | llvm::DenseMap<const Stmt *, Decision> DecisionByStmt; |
| 38 | |
| 39 | struct Branch { |
| 40 | ConditionID ID; |
| 41 | const Stmt *DecisionStmt; |
| 42 | }; |
| 43 | |
| 44 | llvm::DenseMap<const Stmt *, Branch> BranchByStmt; |
| 45 | }; |
| 46 | |
| 47 | } // namespace clang::CodeGen::MCDC |
| 48 | |
| 49 | #endif // LLVM_CLANG_LIB_CODEGEN_MCDCSTATE_H |
| 50 | |