This patch replaces reliance on goto failure pattern with
llvm::scope_exit.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
(A possibly more robust option - so that this doesn't regress if someone adds a new "return true" codepath & forgets to release the cleanup (it looks like a pretty long function with several exits, etc) - would be to move the code into an "impl" function and have the original function call it, check the result, and do the cleanup once?)
Comment Actions
I was talking with @lhames the other day about building a doWithCleanup abstraction that could take a labmda to perform and a lambda to cleanup on failure.
I was thinking I may take a stab at that this week.
Comment Actions
Sure, would be nice - though I'd probably still argue that a 400 line lambda might be a bit unwieldy/unclear.