18 #include "llvm/ADT/DenseMap.h"
20 using namespace clang;
22 typedef llvm::DenseMap<Stmt*, Stmt*>
MapTy;
34 switch (S->getStmtClass()) {
35 case Stmt::PseudoObjectExprClass: {
43 for (
Stmt *SubStmt : S->children())
57 case Stmt::BinaryConditionalOperatorClass: {
58 assert(OVMode ==
OV_Transparent &&
"Should not appear alongside OVEs");
75 case Stmt::OpaqueValueExprClass: {
88 case Stmt::CapturedStmtClass:
89 for (
Stmt *SubStmt : S->children()) {
95 if (
Stmt *SubStmt = cast<CapturedStmt>(S)->getCapturedStmt()) {
100 case Stmt::CXXDefaultArgExprClass:
101 if (
auto *Arg = dyn_cast<CXXDefaultArgExpr>(S)) {
102 if (Arg->hasRewrittenInit()) {
103 M[Arg->getExpr()] = S;
108 case Stmt::CXXDefaultInitExprClass:
109 if (
auto *Init = dyn_cast<CXXDefaultInitExpr>(S)) {
110 if (Init->hasRewrittenInit()) {
111 M[Init->getExpr()] = S;
117 for (
Stmt *SubStmt : S->children()) {
136 delete (
MapTy*) Impl;
149 M->insert(std::make_pair(
const_cast<Stmt *
>(S),
const_cast<Stmt *
>(
Parent)));
158 do { S =
getParent(S); }
while (S && isa<ParenExpr>(S));
166 while (S && (isa<ParenExpr>(S) || isa<CastExpr>(S)));
174 }
while (S && isa<Expr>(S) && cast<Expr>(S)->IgnoreParenImpCasts() != S);
181 while (isa<ParenExpr>(S)) {
190 Stmt *DirectChild = E;
193 while (
P && (isa<ParenExpr>(
P) || isa<CastExpr>(
P) ||
202 switch (
P->getStmtClass()) {
205 case Stmt::DeclStmtClass:
207 case Stmt::BinaryOperatorClass: {
213 case Stmt::ForStmtClass:
214 return DirectChild == cast<ForStmt>(
P)->getCond();
215 case Stmt::WhileStmtClass:
216 return DirectChild == cast<WhileStmt>(
P)->getCond();
217 case Stmt::DoStmtClass:
218 return DirectChild == cast<DoStmt>(
P)->getCond();
219 case Stmt::IfStmtClass:
220 return DirectChild == cast<IfStmt>(
P)->getCond();
221 case Stmt::IndirectGotoStmtClass:
222 return DirectChild == cast<IndirectGotoStmt>(
P)->getTarget();
223 case Stmt::SwitchStmtClass:
224 return DirectChild == cast<SwitchStmt>(
P)->getCond();
225 case Stmt::ObjCForCollectionStmtClass:
226 return DirectChild == cast<ObjCForCollectionStmt>(
P)->getCollection();
227 case Stmt::ReturnStmtClass:
Defines the clang::Expr interface and subclasses for C++ expressions.
static void BuildParentMap(MapTy &M, Stmt *S, OpaqueValueMode OVMode=OV_Transparent)
llvm::DenseMap< Stmt *, Stmt * > MapTy
Defines the Objective-C statement AST node classes.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
A builtin binary operation expression such as "x + y" or "x <= y".
This represents one expression.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
bool isConsumedExpr(Expr *E) const
void addStmt(Stmt *S)
Adds and/or updates the parent/child-relations of the complete stmt tree of S.
void setParent(const Stmt *S, const Stmt *Parent)
Manually sets the parent of S to Parent.
Stmt * getOuterParenParent(Stmt *) const
Stmt * getParentIgnoreParenImpCasts(Stmt *) const
Stmt * getParentIgnoreParenCasts(Stmt *) const
Stmt * getParent(Stmt *) const
Stmt * getParentIgnoreParens(Stmt *) const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
semantics_iterator semantics_end()
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
semantics_iterator semantics_begin()
Expr *const * semantics_iterator
Stmt - This represents one statement.
The JSON file list parser is used to communicate input to InstallAPI.