#include "clang/Analysis/CloneDetection.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DataCollection.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/Path.h"
usingnamespaceclang;
StmtSequence::StmtSequence(const CompoundStmt *Stmt, const Decl *D,
unsigned StartIndex, unsigned EndIndex)
: … { … }
StmtSequence::StmtSequence(const Stmt *Stmt, const Decl *D)
: … { … }
StmtSequence::StmtSequence()
: … { … }
bool StmtSequence::contains(const StmtSequence &Other) const { … }
StmtSequence::iterator StmtSequence::begin() const { … }
StmtSequence::iterator StmtSequence::end() const { … }
ASTContext &StmtSequence::getASTContext() const { … }
SourceLocation StmtSequence::getBeginLoc() const { … }
SourceLocation StmtSequence::getEndLoc() const { … }
SourceRange StmtSequence::getSourceRange() const { … }
void CloneDetector::analyzeCodeBody(const Decl *D) { … }
static bool containsAnyInGroup(StmtSequence &Seq,
CloneDetector::CloneGroup &Group) { … }
static bool containsGroup(CloneDetector::CloneGroup &Group,
CloneDetector::CloneGroup &OtherGroup) { … }
void OnlyLargestCloneConstraint::constrain(
std::vector<CloneDetector::CloneGroup> &Result) { … }
bool FilenamePatternConstraint::isAutoGenerated(
const CloneDetector::CloneGroup &Group) { … }
namespace {
template <class T>
class CloneTypeIIStmtDataCollector
: public ConstStmtVisitor<CloneTypeIIStmtDataCollector<T>> { … };
}
static size_t createHash(llvm::MD5 &Hash) { … }
static size_t
saveHash(const Stmt *S, const Decl *D,
std::vector<std::pair<size_t, StmtSequence>> &StmtsByHash) { … }
namespace {
class FoldingSetNodeIDWrapper { … };
}
static void CollectStmtSequenceData(const StmtSequence &Sequence,
FoldingSetNodeIDWrapper &OutputData) { … }
static bool areSequencesClones(const StmtSequence &LHS,
const StmtSequence &RHS) { … }
void RecursiveCloneTypeIIHashConstraint::constrain(
std::vector<CloneDetector::CloneGroup> &Sequences) { … }
void RecursiveCloneTypeIIVerifyConstraint::constrain(
std::vector<CloneDetector::CloneGroup> &Sequences) { … }
size_t MinComplexityConstraint::calculateStmtComplexity(
const StmtSequence &Seq, std::size_t Limit,
const std::string &ParentMacroStack) { … }
void MatchingVariablePatternConstraint::constrain(
std::vector<CloneDetector::CloneGroup> &CloneGroups) { … }
void CloneConstraint::splitCloneGroups(
std::vector<CloneDetector::CloneGroup> &CloneGroups,
llvm::function_ref<bool(const StmtSequence &, const StmtSequence &)>
Compare) { … }
void VariablePattern::addVariableOccurence(const VarDecl *VarDecl,
const Stmt *Mention) { … }
void VariablePattern::addVariables(const Stmt *S) { … }
unsigned VariablePattern::countPatternDifferences(
const VariablePattern &Other,
VariablePattern::SuspiciousClonePair *FirstMismatch) { … }