clang 20.0.0git
|
Holds CFG with additional information derived from it that is needed to perform dataflow analysis. More...
#include "clang/Analysis/FlowSensitive/AdornedCFG.h"
Public Member Functions | |
const Decl & | getDecl () const |
Returns the Decl containing the statement used to construct the CFG, if available. | |
const CFG & | getCFG () const |
Returns the CFG that is stored in this context. | |
const CFGBlock * | blockForStmt (const Stmt &S) const |
Returns the basic block that contains S , or null if no basic block containing S is found. | |
bool | isBlockReachable (const CFGBlock &B) const |
Returns whether B is reachable from the entry block. | |
bool | containsExprConsumedInDifferentBlock (const CFGBlock &B) const |
Returns whether B contains an expression that is consumed in a different block than B (i.e. | |
Static Public Member Functions | |
static llvm::Expected< AdornedCFG > | build (const FunctionDecl &Func) |
Builds an AdornedCFG from a FunctionDecl . | |
static llvm::Expected< AdornedCFG > | build (const Decl &D, Stmt &S, ASTContext &C) |
Builds an AdornedCFG from an AST node. | |
Holds CFG with additional information derived from it that is needed to perform dataflow analysis.
Definition at line 47 of file AdornedCFG.h.
Returns the basic block that contains S
, or null if no basic block containing S
is found.
Definition at line 68 of file AdornedCFG.h.
References clang::dataflow::internal::StmtToBlockMap::lookup().
Referenced by clang::dataflow::StmtToEnvMap::getEnvironment().
|
static |
Builds an AdornedCFG
from an AST node.
D
is the function in which S
resides. D.isTemplated()
must be false.
Definition at line 145 of file AdornedCFG.cpp.
References clang::CFG::buildCFG(), clang::dataflow::buildContainsExprConsumedInDifferentBlock(), clang::C, D, and clang::dataflow::findReachableBlocks().
|
static |
Builds an AdornedCFG
from a FunctionDecl
.
Func.doesThisDeclarationHaveABody()
must be true, and Func.isTemplated()
must be false.
Definition at line 136 of file AdornedCFG.cpp.
References build(), and clang::Func.
Referenced by build(), and clang::dataflow::diagnoseFunction().
|
inline |
Returns whether B
contains an expression that is consumed in a different block than B
(i.e.
the parent of the expression is in a different block). This happens if there is control flow within a full-expression (triggered by &&
, ||
, or the conditional operator). Note that the operands of these operators are not the only expressions that can be consumed in a different block. For example, in the function call f(&i, cond() ? 1 : 0)
, &i
is in a different block than the CallExpr
.
Definition at line 85 of file AdornedCFG.h.
|
inline |
Returns the CFG that is stored in this context.
Definition at line 64 of file AdornedCFG.h.
|
inline |
Returns the Decl
containing the statement used to construct the CFG, if available.
Definition at line 61 of file AdornedCFG.h.
Returns whether B
is reachable from the entry block.
Definition at line 73 of file AdornedCFG.h.
References clang::CFGBlock::getBlockID().
Referenced by clang::dataflow::StmtToEnvMap::getEnvironment().