clang 20.0.0git
|
Identifies a list of statements. More...
#include "clang/Analysis/CloneDetection.h"
Public Types | |
typedef const Stmt *const * | iterator |
Public Member Functions | |
StmtSequence (const CompoundStmt *Stmt, const Decl *D, unsigned StartIndex, unsigned EndIndex) | |
Constructs a StmtSequence holding multiple statements. | |
StmtSequence (const Stmt *Stmt, const Decl *D) | |
Constructs a StmtSequence holding a single statement. | |
StmtSequence () | |
Constructs an empty StmtSequence. | |
iterator | begin () const |
Returns an iterator pointing to the first statement in this sequence. | |
iterator | end () const |
Returns an iterator pointing behind the last statement in this sequence. | |
const Stmt * | front () const |
Returns the first statement in this sequence. | |
const Stmt * | back () const |
Returns the last statement in this sequence. | |
unsigned | size () const |
Returns the number of statements this object holds. | |
bool | empty () const |
Returns true if and only if this StmtSequence contains no statements. | |
ASTContext & | getASTContext () const |
Returns the related ASTContext for the stored Stmts. | |
const Decl * | getContainingDecl () const |
Returns the declaration that contains the stored Stmts. | |
bool | holdsSequence () const |
Returns true if this objects holds a list of statements. | |
SourceLocation | getBeginLoc () const |
Returns the start sourcelocation of the first statement in this sequence. | |
SourceLocation | getEndLoc () const |
Returns the end sourcelocation of the last statement in this sequence. | |
SourceRange | getSourceRange () const |
Returns the source range of the whole sequence - from the beginning of the first statement to the end of the last statement. | |
bool | operator== (const StmtSequence &Other) const |
bool | operator!= (const StmtSequence &Other) const |
bool | contains (const StmtSequence &Other) const |
Returns true if and only if this sequence covers a source range that contains the source range of the given sequence Other . | |
Identifies a list of statements.
Can either identify a single arbitrary Stmt object, a continuous sequence of child statements inside a CompoundStmt or no statements at all.
Definition at line 33 of file CloneDetection.h.
typedef const Stmt* const* clang::StmtSequence::iterator |
Definition at line 73 of file CloneDetection.h.
StmtSequence::StmtSequence | ( | const CompoundStmt * | Stmt, |
const Decl * | D, | ||
unsigned | StartIndex, | ||
unsigned | EndIndex | ||
) |
Constructs a StmtSequence holding multiple statements.
The resulting StmtSequence identifies a continuous sequence of statements in the body of the given CompoundStmt. Which statements of the body should be identified needs to be specified by providing a start and end index that describe a non-empty sub-array in the body of the given CompoundStmt.
Stmt | A CompoundStmt that contains all statements in its body. |
D | The Decl containing this Stmt. |
StartIndex | The inclusive start index in the children array of Stmt |
EndIndex | The exclusive end index in the children array of Stmt . |
Definition at line 23 of file CloneDetection.cpp.
References size().
Constructs a StmtSequence holding a single statement.
Definition at line 31 of file CloneDetection.cpp.
StmtSequence::StmtSequence | ( | ) |
Constructs an empty StmtSequence.
Definition at line 34 of file CloneDetection.cpp.
|
inline |
Returns the last statement in this sequence.
This method should only be called on a non-empty StmtSequence object.
Definition at line 92 of file CloneDetection.h.
References begin(), empty(), and size().
Referenced by getEndLoc().
StmtSequence::iterator StmtSequence::begin | ( | ) | const |
Returns an iterator pointing to the first statement in this sequence.
Definition at line 59 of file CloneDetection.cpp.
References holdsSequence().
bool StmtSequence::contains | ( | const StmtSequence & | Other | ) | const |
Returns true if and only if this sequence covers a source range that contains the source range of the given sequence Other
.
This method should only be called on a non-empty StmtSequence object and passed a non-empty StmtSequence object.
Definition at line 37 of file CloneDetection.cpp.
References getASTContext(), getBeginLoc(), getEndLoc(), clang::ASTContext::getSourceManager(), clang::Other, and SM.
|
inline |
Returns true if and only if this StmtSequence contains no statements.
Definition at line 107 of file CloneDetection.h.
References size().
StmtSequence::iterator StmtSequence::end | ( | ) | const |
Returns an iterator pointing behind the last statement in this sequence.
Definition at line 67 of file CloneDetection.cpp.
References holdsSequence().
|
inline |
Returns the first statement in this sequence.
This method should only be called on a non-empty StmtSequence object.
Definition at line 84 of file CloneDetection.h.
References begin(), and empty().
Referenced by getBeginLoc().
ASTContext & StmtSequence::getASTContext | ( | ) | const |
Returns the related ASTContext for the stored Stmts.
Definition at line 75 of file CloneDetection.cpp.
References clang::Decl::getASTContext().
Referenced by CollectStmtSequenceData(), and contains().
SourceLocation StmtSequence::getBeginLoc | ( | ) | const |
Returns the start sourcelocation of the first statement in this sequence.
This method should only be called on a non-empty StmtSequence object.
Definition at line 80 of file CloneDetection.cpp.
References front(), and clang::Stmt::getBeginLoc().
Referenced by contains(), and getSourceRange().
|
inline |
Returns the declaration that contains the stored Stmts.
Definition at line 113 of file CloneDetection.h.
References D.
Referenced by CollectStmtSequenceData().
SourceLocation StmtSequence::getEndLoc | ( | ) | const |
Returns the end sourcelocation of the last statement in this sequence.
This method should only be called on a non-empty StmtSequence object.
Definition at line 84 of file CloneDetection.cpp.
References back(), and clang::Stmt::getEndLoc().
Referenced by contains(), and getSourceRange().
SourceRange StmtSequence::getSourceRange | ( | ) | const |
Returns the source range of the whole sequence - from the beginning of the first statement to the end of the last statement.
Definition at line 86 of file CloneDetection.cpp.
References getBeginLoc(), and getEndLoc().
|
inline |
Returns true if this objects holds a list of statements.
Definition at line 119 of file CloneDetection.h.
|
inline |
Definition at line 140 of file CloneDetection.h.
References clang::Other.
|
inline |
Definition at line 135 of file CloneDetection.h.
References clang::Other.
|
inline |
Returns the number of statements this object holds.
Definition at line 98 of file CloneDetection.h.
References holdsSequence().
Referenced by back(), empty(), and StmtSequence().