CodeQL library for C/C++
Search

Module CodeDuplication

Provides classes for detecting duplicate or similar code.

Import path

import external.CodeDuplication

Imports

cpp

Provides classes and predicates for working with C/C++ code.

Predicates

classLevelDuplication

Holds if most member functions of c are duplicates of member functions in other.

duplicateFiles

Holds if most of f (percent%) is duplicated by other.

duplicateLines

INTERNAL: do not use.

duplicateLinesCovered

Holds if coveredLines lines of f are duplicates of lines in otherFile.

duplicateMethod

Holds if m and other are identical functions.

duplicateStatements

Holds if m1 is a function with total lines, and m2 is a function that has duplicate lines in common with m1.

fileLevelDuplication

Holds if f and other are similar or duplicates.

mostlyDuplicateClass

Holds if most member functions of c are duplicates of member functions in other. Provides the human-readable message to describe the amount of duplication.

mostlyDuplicateClassBase

Holds if most member functions of c (numDup out of total) are duplicates of member functions in other.

numberOfSourceMethods

Gets the number of member functions in c with a body and a location.

similarFiles

Holds if most of f (percent%) is similar to other.

similarLines

INTERNAL: do not use.

similarLinesCovered

Holds if coveredLines lines of f are similar to lines in otherFile.

sourceMethod

Gets a function with a body and a location.

whitelistedLineForDuplication

Holds if line in f should be allowed to be duplicated. This is the case for #include directives.

Classes

Copy

A token block used for detection of duplicate and similar code.

DuplicateBlock

A block of duplicated code.

SimilarBlock

A block of similar code.