<div dir="ltr"><div><div><div><div><div><div>Hi,<br></div>In a lot of the examples, a clang tool is invoked in the following way:<br><br>Tool.run(newFrontendActionFactory<ActionType>().get());<br><br></div>The problem is that this does not allow the user to construct their object with arguments.<br></div>The solution is implementing a FrontendActionFactory and overriding create.<br></div><br>This is overkill in my opinion and can be easily integrated into the SimpleFrontendActionFactory class defined in the library function as follows.<br><br>template <typename T><br>std::unique_ptr<FrontendActionFactory> newFrontendActionFactory() {<br>  class SimpleFrontendActionFactory : public FrontendActionFactory {<br>  public:<br>    clang::FrontendAction *create() override { return new T; }<br>  };<br><br>  return std::unique_ptr<FrontendActionFactory>(<br>      new SimpleFrontendActionFactory);<br>}<br><br></div>This can be adapted to to use variadic templates, store the arguments somehow and use them when constructing the new T.<br><br></div>Is that a viable idea?<br><div>Manasij Mukherjee<br></div></div>