LLVM 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::coverage::MCDCRecord Struct Reference

MCDC Record grouping all information together. More...

#include "llvm/ProfileData/Coverage/CoverageMapping.h"

Classes

class  TestVector
 Emulate SmallVector<CondState> with a pair of BitVector. More...
 

Public Types

enum  CondState { MCDC_DontCare = -1 , MCDC_False = 0 , MCDC_True = 1 }
 CondState represents the evaluation of a condition in an executed test vector, which can be True or False. More...
 
using TestVectors = llvm::SmallVector< std::pair< TestVector, CondState > >
 
using BoolVector = llvm::SmallVector< bool >
 
using TVRowPair = std::pair< unsigned, unsigned >
 
using TVPairMap = llvm::DenseMap< unsigned, TVRowPair >
 
using CondIDMap = llvm::DenseMap< unsigned, unsigned >
 
using LineColPairMap = llvm::DenseMap< unsigned, LineColPair >
 

Public Member Functions

 MCDCRecord (const CounterMappingRegion &Region, TestVectors &&TV, TVPairMap &&IndependencePairs, BoolVector &&Folded, CondIDMap &&PosToID, LineColPairMap &&CondLoc)
 
CounterMappingRegion getDecisionRegion () const
 
unsigned getNumConditions () const
 
unsigned getNumTestVectors () const
 
bool isCondFolded (unsigned Condition) const
 
CondState getTVCondition (unsigned TestVectorIndex, unsigned Condition)
 Return the evaluation of a condition (indicated by Condition) in an executed test vector (indicated by TestVectorIndex), which will be True, False, or DontCare if the condition is unevaluatable.
 
CondState getTVResult (unsigned TestVectorIndex)
 Return the Result evaluation for an executed test vector.
 
bool isConditionIndependencePairCovered (unsigned Condition) const
 Determine whether a given condition (indicated by Condition) is covered by an Independence Pair.
 
TVRowPair getConditionIndependencePair (unsigned Condition)
 Return the Independence Pair that covers the given condition.
 
float getPercentCovered () const
 
std::string getConditionHeaderString (unsigned Condition)
 
std::string getTestVectorHeaderString () const
 
std::string getTestVectorString (unsigned TestVectorIndex)
 
std::string getConditionCoverageString (unsigned Condition)
 

Detailed Description

MCDC Record grouping all information together.

Definition at line 378 of file CoverageMapping.h.

Member Typedef Documentation

◆ BoolVector

Definition at line 440 of file CoverageMapping.h.

◆ CondIDMap

Definition at line 443 of file CoverageMapping.h.

◆ LineColPairMap

Definition at line 444 of file CoverageMapping.h.

◆ TestVectors

Definition at line 439 of file CoverageMapping.h.

◆ TVPairMap

Definition at line 442 of file CoverageMapping.h.

◆ TVRowPair

Definition at line 441 of file CoverageMapping.h.

Member Enumeration Documentation

◆ CondState

CondState represents the evaluation of a condition in an executed test vector, which can be True or False.

A DontCare is used to mask an unevaluatable condition resulting from short-circuit behavior of logical operators in languages like C/C++. When comparing the evaluation of a condition across executed test vectors, comparisons against a DontCare are effectively ignored.

Enumerator
MCDC_DontCare 
MCDC_False 
MCDC_True 

Definition at line 385 of file CoverageMapping.h.

Constructor & Destructor Documentation

◆ MCDCRecord()

llvm::coverage::MCDCRecord::MCDCRecord ( const CounterMappingRegion Region,
TestVectors &&  TV,
TVPairMap &&  IndependencePairs,
BoolVector &&  Folded,
CondIDMap &&  PosToID,
LineColPairMap &&  CondLoc 
)
inline

Definition at line 455 of file CoverageMapping.h.

Member Function Documentation

◆ getConditionCoverageString()

std::string llvm::coverage::MCDCRecord::getConditionCoverageString ( unsigned  Condition)
inline

◆ getConditionHeaderString()

std::string llvm::coverage::MCDCRecord::getConditionHeaderString ( unsigned  Condition)
inline

Definition at line 524 of file CoverageMapping.h.

References OS.

◆ getConditionIndependencePair()

TVRowPair llvm::coverage::MCDCRecord::getConditionIndependencePair ( unsigned  Condition)
inline

Return the Independence Pair that covers the given condition.

Because condition IDs are not associated based on their position in the expression, accessing conditions in the TestVectors requires a translation from a ordinal position to actual condition ID. This is done via PosToID[].

Definition at line 503 of file CoverageMapping.h.

References assert(), and isConditionIndependencePairCovered().

Referenced by getConditionCoverageString().

◆ getDecisionRegion()

CounterMappingRegion llvm::coverage::MCDCRecord::getDecisionRegion ( ) const
inline

Definition at line 463 of file CoverageMapping.h.

◆ getNumConditions()

unsigned llvm::coverage::MCDCRecord::getNumConditions ( ) const
inline

◆ getNumTestVectors()

unsigned llvm::coverage::MCDCRecord::getNumTestVectors ( ) const
inline

◆ getPercentCovered()

float llvm::coverage::MCDCRecord::getPercentCovered ( ) const
inline

◆ getTestVectorHeaderString()

std::string llvm::coverage::MCDCRecord::getTestVectorHeaderString ( ) const
inline

Definition at line 532 of file CoverageMapping.h.

References getNumConditions(), getNumTestVectors(), I, and OS.

◆ getTestVectorString()

std::string llvm::coverage::MCDCRecord::getTestVectorString ( unsigned  TestVectorIndex)
inline

◆ getTVCondition()

CondState llvm::coverage::MCDCRecord::getTVCondition ( unsigned  TestVectorIndex,
unsigned  Condition 
)
inline

Return the evaluation of a condition (indicated by Condition) in an executed test vector (indicated by TestVectorIndex), which will be True, False, or DontCare if the condition is unevaluatable.

Because condition IDs are not associated based on their position in the expression, accessing conditions in the TestVectors requires a translation from a ordinal position to actual condition ID. This is done via PosToID[].

Definition at line 476 of file CoverageMapping.h.

Referenced by getTestVectorString().

◆ getTVResult()

CondState llvm::coverage::MCDCRecord::getTVResult ( unsigned  TestVectorIndex)
inline

Return the Result evaluation for an executed test vector.

See MCDCRecordProcessor::RecordTestVector().

Definition at line 482 of file CoverageMapping.h.

Referenced by getTestVectorString().

◆ isCondFolded()

bool llvm::coverage::MCDCRecord::isCondFolded ( unsigned  Condition) const
inline

◆ isConditionIndependencePairCovered()

bool llvm::coverage::MCDCRecord::isConditionIndependencePairCovered ( unsigned  Condition) const
inline

Determine whether a given condition (indicated by Condition) is covered by an Independence Pair.

Because condition IDs are not associated based on their position in the expression, accessing conditions in the TestVectors requires a translation from a ordinal position to actual condition ID. This is done via PosToID[].

Definition at line 491 of file CoverageMapping.h.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::contains(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and llvm_unreachable.

Referenced by getConditionCoverageString(), getConditionIndependencePair(), and getPercentCovered().


The documentation for this struct was generated from the following file: