clang  7.0.0svn
Public Member Functions | List of all members
clang::MinComplexityConstraint Class Reference

Ensures that every clone has at least the given complexity. More...

#include "clang/Analysis/CloneDetection.h"

Public Member Functions

 MinComplexityConstraint (unsigned MinComplexity)
size_t calculateStmtComplexity (const StmtSequence &Seq, std::size_t Limit, const std::string &ParentMacroStack="")
 Calculates the complexity of the given StmtSequence. More...
void constrain (std::vector< CloneDetector::CloneGroup > &CloneGroups)

Detailed Description

Ensures that every clone has at least the given complexity.

Complexity is here defined as the total amount of children of a statement. This constraint assumes the first statement in the group is representative for all other statements in the group in terms of complexity.

Definition at line 284 of file CloneDetection.h.

Constructor & Destructor Documentation

◆ MinComplexityConstraint()

clang::MinComplexityConstraint::MinComplexityConstraint ( unsigned  MinComplexity)

Definition at line 288 of file CloneDetection.h.

Member Function Documentation

◆ calculateStmtComplexity()

size_t MinComplexityConstraint::calculateStmtComplexity ( const StmtSequence Seq,
std::size_t  Limit,
const std::string &  ParentMacroStack = "" 

Calculates the complexity of the given StmtSequence.

LimitThe limit of complexity we probe for. After reaching this limit during calculation, this method is exiting early to improve performance and returns this limit.

Definition at line 424 of file CloneDetection.cpp.

References clang::StmtSequence::empty().

◆ constrain()

void clang::MinComplexityConstraint::constrain ( std::vector< CloneDetector::CloneGroup > &  CloneGroups)

Definition at line 298 of file CloneDetection.h.

References clang::CloneConstraint::filterGroups().

The documentation for this class was generated from the following files: