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: {
86 case Stmt::CapturedStmtClass:
93 if (
Stmt *SubStmt = cast<CapturedStmt>(S)->getCapturedStmt()) {
118 delete (
MapTy*) Impl;
131 M->insert(std::make_pair(const_cast<Stmt *>(S), const_cast<Stmt *>(Parent)));
136 MapTy::iterator I = M->find(S);
137 return I == M->end() ? nullptr : I->second;
141 do { S =
getParent(S); }
while (S && isa<ParenExpr>(S));
149 while (S && (isa<ParenExpr>(S) || isa<CastExpr>(S)));
157 }
while (S && isa<Expr>(S) && cast<Expr>(S)->IgnoreParenImpCasts() != S);
164 while (isa<ParenExpr>(S)) {
173 Stmt *DirectChild = E;
176 while (P && (isa<ParenExpr>(P) || isa<CastExpr>(P) ||
188 case Stmt::DeclStmtClass:
190 case Stmt::BinaryOperatorClass: {
196 case Stmt::ForStmtClass:
197 return DirectChild == cast<ForStmt>(
P)->getCond();
198 case Stmt::WhileStmtClass:
199 return DirectChild == cast<WhileStmt>(
P)->getCond();
200 case Stmt::DoStmtClass:
201 return DirectChild == cast<DoStmt>(
P)->getCond();
202 case Stmt::IfStmtClass:
203 return DirectChild == cast<IfStmt>(
P)->getCond();
204 case Stmt::IndirectGotoStmtClass:
205 return DirectChild == cast<IndirectGotoStmt>(
P)->getTarget();
206 case Stmt::SwitchStmtClass:
207 return DirectChild == cast<SwitchStmt>(
P)->getCond();
208 case Stmt::ObjCForCollectionStmtClass:
209 return DirectChild == cast<ObjCForCollectionStmt>(
P)->getCollection();
210 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 Objective-C statement AST node classes.
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".
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