clayborg added a comment. In https://reviews.llvm.org/D47992#1139691, @apolyakov wrote:
> I didn't committed patch https://reviews.llvm.org/D48295 yet, so I think if > we change `HandleSBError` handlers from > `std::function<bool/void()>` to `std::function<bool/boid(CMICmdBase *)>` > we'll be able to create anonymous namespace and declare there a function that > takes a pointer to current command class(`this` pointer) instead if defining > > auto successHandler = [this] { > // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM > if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) { > const CMIUtilString > &rErrMsg(CMIDriver::Instance().GetErrorDescription()); > this->SetError(CMIUtilString::Format( > MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), > this->m_cmdData.strMiCmd.c_str(), > rErrMsg.c_str())); > return MIstatus::failure; > } > return MIstatus::success; > > > 3 times in one file. It will reduce duplicating of code but I still think, is > it worth it? Maybe add a command class that the 3 commands can inherit from and add a this code as a method that the other 3 commands can call? If this is specific to execution, it might consolidate the code nicely? https://reviews.llvm.org/D47992 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits