diff --git a/src/script_opt/ProfileFunc.cc b/src/script_opt/ProfileFunc.cc index aad6cc3004..1a3b378756 100644 --- a/src/script_opt/ProfileFunc.cc +++ b/src/script_opt/ProfileFunc.cc @@ -85,6 +85,12 @@ ProfileFunc::ProfileFunc(const Expr* e, bool _abs_rec_fields) e->Traverse(this); } +ProfileFunc::ProfileFunc(const Stmt* s, bool _abs_rec_fields) + { + abs_rec_fields = _abs_rec_fields; + s->Traverse(this); + } + void ProfileFunc::Profile(const FuncType* ft, const StmtPtr& body) { num_params = ft->Params()->NumFields(); diff --git a/src/script_opt/ProfileFunc.h b/src/script_opt/ProfileFunc.h index dea9232179..8870caeeb2 100644 --- a/src/script_opt/ProfileFunc.h +++ b/src/script_opt/ProfileFunc.h @@ -86,11 +86,12 @@ public: // function and one of its bodies. ProfileFunc(const Func* func, const StmtPtr& body, bool abs_rec_fields); - // Constructor for profiling an AST expression. This exists - // to support (1) profiling lambda expressions, and (2) traversing - // attribute expressions (such as &default=expr) to discover what - // components they include. - ProfileFunc(const Expr* func, bool abs_rec_fields); + // Constructors for profiling an AST statement expression. These exist + // to support (1) profiling lambda expressions and loop bodies, and + // (2) traversing attribute expressions (such as &default=expr) + // to discover what components they include. + ProfileFunc(const Stmt* body, bool abs_rec_fields = false); + ProfileFunc(const Expr* func, bool abs_rec_fields = false); // See the comments for the associated member variables for each // of these accessors.