19 #include "llvm/ADT/DenseMap.h" 21 using namespace clang;
23 typedef llvm::DenseMap<Stmt*, Stmt*>
MapTy;
36 case Stmt::PseudoObjectExprClass: {
37 assert(OVMode ==
OV_Transparent &&
"Should not appear alongside OVEs");
56 case Stmt::BinaryConditionalOperatorClass: {
57 assert(OVMode ==
OV_Transparent &&
"Should not appear alongside OVEs");
74 case Stmt::OpaqueValueExprClass: {
107 delete (
MapTy*) Impl;
120 M->insert(std::make_pair(const_cast<Stmt *>(S), const_cast<Stmt *>(Parent)));
125 MapTy::iterator I = M->find(S);
126 return I == M->end() ? nullptr : I->second;
130 do { S =
getParent(S); }
while (S && isa<ParenExpr>(S));
138 while (S && (isa<ParenExpr>(S) || isa<CastExpr>(S)));
146 }
while (S && isa<Expr>(S) && cast<Expr>(S)->IgnoreParenImpCasts() != S);
153 while (isa<ParenExpr>(S)) {
162 Stmt *DirectChild = E;
165 while (P && (isa<ParenExpr>(P) || isa<CastExpr>(P) ||
166 isa<ExprWithCleanups>(P))) {
177 case Stmt::DeclStmtClass:
179 case Stmt::BinaryOperatorClass: {
185 case Stmt::ForStmtClass:
186 return DirectChild == cast<ForStmt>(
P)->getCond();
187 case Stmt::WhileStmtClass:
188 return DirectChild == cast<WhileStmt>(
P)->getCond();
189 case Stmt::DoStmtClass:
190 return DirectChild == cast<DoStmt>(
P)->getCond();
191 case Stmt::IfStmtClass:
192 return DirectChild == cast<IfStmt>(
P)->getCond();
193 case Stmt::IndirectGotoStmtClass:
194 return DirectChild == cast<IndirectGotoStmt>(
P)->getTarget();
195 case Stmt::SwitchStmtClass:
196 return DirectChild == cast<SwitchStmt>(
P)->getCond();
197 case Stmt::ObjCForCollectionStmtClass:
198 return DirectChild == cast<ObjCForCollectionStmt>(
P)->getCollection();
199 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".
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