clang-tools 20.0.0git
|
Class used to determine if an expression is dependent on a variable declared inside of the loop where it would be used. More...
#include <LoopConvertUtils.h>
Public Member Functions | |
DependencyFinderASTVisitor (const StmtParentMap *StmtParents, const DeclParentMap *DeclParents, const ReplacedVarsMap *ReplacedVars, const clang::Stmt *ContainingStmt) | |
bool | dependsOnInsideVariable (const clang::Stmt *Body) |
Run the analysis on Body, and return true iff the expression depends on some variable declared within ContainingStmt. | |
Friends | |
class | clang::RecursiveASTVisitor< DependencyFinderASTVisitor > |
Class used to determine if an expression is dependent on a variable declared inside of the loop where it would be used.
Definition at line 112 of file LoopConvertUtils.h.
|
inline |
Definition at line 115 of file LoopConvertUtils.h.
|
inline |
Run the analysis on Body, and return true iff the expression depends on some variable declared within ContainingStmt.
This is intended to protect against hoisting the container expression outside of an inner context if part of that expression is declared in that inner context.
For example,
At first glance, this loop looks like it could be changed to
But this is malformed, since k
is used before it is defined!
In order to avoid this, this class looks at the container expression arr[k]
and decides whether or not it contains a sub-expression declared within the loop body.
Definition at line 152 of file LoopConvertUtils.h.
Referenced by clang::tidy::modernize::LoopConvertCheck::check().
|
friend |
Definition at line 152 of file LoopConvertUtils.h.