1//===- MCDCTypes.h - Types related to MC/DC Coverage ------------*- 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// Types related to MC/DC Coverage.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_PROFILEDATA_COVERAGE_MCDCTYPES_H
14#define LLVM_PROFILEDATA_COVERAGE_MCDCTYPES_H
15
16#include <array>
17#include <variant>
18
19namespace llvm::coverage::mcdc {
20
21/// The ID for MCDCBranch.
22using ConditionID = unsigned int;
23using ConditionIDs = std::array<ConditionID, 2>;
24
25struct DecisionParameters {
26 /// Byte Index of Bitmap Coverage Object for a Decision Region.
27 unsigned BitmapIdx;
28
29 /// Number of Conditions used for a Decision Region.
30 unsigned NumConditions;
31
32 DecisionParameters() = delete;
33 DecisionParameters(unsigned BitmapIdx, unsigned NumConditions)
34 : BitmapIdx(BitmapIdx), NumConditions(NumConditions) {}
35};
36
37struct BranchParameters {
38 /// IDs used to represent a branch region and other branch regions
39 /// evaluated based on True and False branches.
40 ConditionID ID;
41 ConditionIDs Conds;
42
43 BranchParameters() = delete;
44 BranchParameters(ConditionID ID, const ConditionIDs &Conds)
45 : ID(ID), Conds(Conds) {}
46};
47
48/// The type of MC/DC-specific parameters.
49using Parameters =
50 std::variant<std::monostate, DecisionParameters, BranchParameters>;
51
52} // namespace llvm::coverage::mcdc
53
54#endif // LLVM_PROFILEDATA_COVERAGE_MCDCTYPES_H
55

source code of llvm/include/llvm/ProfileData/Coverage/MCDCTypes.h