lib/Sema/SemaDeclAttr.cpp
bool isBodyLikeChildStmt(const Stmt *S, const Stmt *Parent) {
  switch (Parent->getStmtClass()) {
  case Stmt::IfStmtClass:
    return cast<IfStmt>(Parent)->getThen() == S ||
           cast<IfStmt>(Parent)->getElse() == S;
  case Stmt::WhileStmtClass:
    return cast<WhileStmt>(Parent)->getBody() == S;
  case Stmt::DoStmtClass:
    return cast<DoStmt>(Parent)->getBody() == S;
  case Stmt::ForStmtClass:
    return cast<ForStmt>(Parent)->getBody() == S;
  case Stmt::CXXForRangeStmtClass:
    return cast<CXXForRangeStmt>(Parent)->getBody() == S;
  case Stmt::ObjCForCollectionStmtClass:
    return cast<ObjCForCollectionStmt>(Parent)->getBody() == S;
  case Stmt::CaseStmtClass:
  case Stmt::DefaultStmtClass:
    return cast<SwitchCase>(Parent)->getSubStmt() == S;
  default:
    return false;
  }
}
/// Returns true if the given statement can be a body-like child of \p Parent.
Returns true if the given statement can be a body-like child of \p Parent.
Returns true if the given statement can be a body - like child of \ p Parent .
bool isBodyLikeChildStmt(const Stmt *S, const Stmt *Parent) {
  switch (Parent->getStmtClass()) {
  case Stmt::IfStmtClass:
    return cast<IfStmt>(Parent)->getThen() == S ||
           cast<IfStmt>(Parent)->getElse() == S;
  case Stmt::WhileStmtClass:
    return cast<WhileStmt>(Parent)->getBody() == S;
  case Stmt::DoStmtClass:
    return cast<DoStmt>(Parent)->getBody() == S;
  case Stmt::ForStmtClass:
    return cast<ForStmt>(Parent)->getBody() == S;
  case Stmt::CXXForRangeStmtClass:
    return cast<CXXForRangeStmt>(Parent)->getBody() == S;
  case Stmt::ObjCForCollectionStmtClass:
    return cast<ObjCForCollectionStmt>(Parent)->getBody() == S;
  case Stmt::CaseStmtClass:
  case Stmt::DefaultStmtClass:
    return cast<SwitchCase>(Parent)->getSubStmt() == S;
  default:
    return false;
  }
}
bool isBodyLikeChildStmt ( const Stmt * S , const Stmt * Parent ) { switch ( Parent -> getStmtClass ( ) ) { case Stmt :: IfStmtClass : return cast < IfStmt > ( Parent ) -> getThen ( ) == S || cast < IfStmt > ( Parent ) -> getElse ( ) == S ; case Stmt :: WhileStmtClass : return cast < WhileStmt > ( Parent ) -> getBody ( ) == S ; case Stmt :: DoStmtClass : return cast < DoStmt > ( Parent ) -> getBody ( ) == S ; case Stmt :: ForStmtClass : return cast < ForStmt > ( Parent ) -> getBody ( ) == S ; case Stmt :: CXXForRangeStmtClass : return cast < CXXForRangeStmt > ( Parent ) -> getBody ( ) == S ; case Stmt :: ObjCForCollectionStmtClass : return cast < ObjCForCollectionStmt > ( Parent ) -> getBody ( ) == S ; case Stmt :: CaseStmtClass : case Stmt :: DefaultStmtClass : return cast < SwitchCase > ( Parent ) -> getSubStmt ( ) == S ; default : return false ; } }
Returns true if the given statement can be a body-like child of \p Parent.
Returns true if the given statement can be a body - like child of \ p Parent .