boost::python::list get_children(clang::FunctionDecl& decl) { boost::python::list children = boost::python::list(); for(auto it = decl.param_begin(), it_end = decl.param_end(); it != it_end; ++it) { children.append(boost::python::ptr(*it)); } return children; }
clang::Stmt *stmtNo(int index) { return *boost::next(parsedFunctionDecl->getBody()->child_begin(), index); }
void expectGetRangeForStmtNoAndReturn(int index, LocationRange range) { auto& sourceManager = parsedFunctionDecl->getASTContext().getSourceManager(); EXPECT_CALL(*this, getStmtRange(Ref(sourceManager), Ref(*stmtNo(index)))) .WillRepeatedly(Return(range)); }
ast::Statements getFunctionStatements(clang::FunctionDecl& f, GetStatementRange getStmtRange) { StatementTranslator translator(getStmtRange, f.getASTContext().getSourceManager()); return translator.translateStmts(f.getBody()->children()); }