18 #include "llvm/ADT/DenseMap.h" 20 using namespace clang;
22 typedef llvm::DenseMap<Stmt*, Stmt*>
MapTy;
35 case Stmt::PseudoObjectExprClass: {
36 assert(OVMode ==
OV_Transparent &&
"Should not appear alongside OVEs");
55 case Stmt::BinaryConditionalOperatorClass: {
56 assert(OVMode ==
OV_Transparent &&
"Should not appear alongside OVEs");
73 case Stmt::OpaqueValueExprClass: {
106 delete (
MapTy*) Impl;
119 M->insert(std::make_pair(const_cast<Stmt *>(S), const_cast<Stmt *>(Parent)));
124 MapTy::iterator I = M->find(S);
125 return I == M->end() ? nullptr : I->second;
129 do { S =
getParent(S); }
while (S && isa<ParenExpr>(S));
137 while (S && (isa<ParenExpr>(S) || isa<CastExpr>(S)));
145 }
while (S && isa<Expr>(S) && cast<Expr>(S)->IgnoreParenImpCasts() != S);
152 while (isa<ParenExpr>(S)) {
161 Stmt *DirectChild = E;
164 while (P && (isa<ParenExpr>(P) || isa<CastExpr>(P) ||
165 isa<ExprWithCleanups>(P))) {
176 case Stmt::DeclStmtClass:
178 case Stmt::BinaryOperatorClass: {
184 case Stmt::ForStmtClass:
185 return DirectChild == cast<ForStmt>(
P)->getCond();
186 case Stmt::WhileStmtClass:
187 return DirectChild == cast<WhileStmt>(
P)->getCond();
188 case Stmt::DoStmtClass:
189 return DirectChild == cast<DoStmt>(
P)->getCond();
190 case Stmt::IfStmtClass:
191 return DirectChild == cast<IfStmt>(
P)->getCond();
192 case Stmt::IndirectGotoStmtClass:
193 return DirectChild == cast<IndirectGotoStmt>(
P)->getTarget();
194 case Stmt::SwitchStmtClass:
195 return DirectChild == cast<SwitchStmt>(
P)->getCond();
196 case Stmt::ReturnStmtClass:
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Expr *const * semantics_iterator
Stmt - This represents one statement.
Stmt * getParent(Stmt *) const
llvm::DenseMap< Stmt *, Stmt * > MapTy
bool isConsumedExpr(Expr *E) const
Defines the clang::Expr interface and subclasses for C++ expressions.
void addStmt(Stmt *S)
Adds and/or updates the parent/child-relations of the complete stmt tree of S.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
void setParent(const Stmt *S, const Stmt *Parent)
Manually sets the parent of S to Parent.
semantics_iterator semantics_end()
A builtin binary operation expression such as "x + y" or "x <= y".
Expr - This represents one expression.
static void BuildParentMap(MapTy &M, Stmt *S, OpaqueValueMode OVMode=OV_Transparent)
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Stmt * getParentIgnoreParens(Stmt *) const
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Dataflow Directional Tag Classes.
StmtClass getStmtClass() const
semantics_iterator semantics_begin()
Stmt * getParentIgnoreParenImpCasts(Stmt *) const
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Stmt * getParentIgnoreParenCasts(Stmt *) const
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Stmt * getOuterParenParent(Stmt *) const