This is an archive of the discontinued LLVM Phabricator instance.

Add Cleanup class.
AbandonedPublic

Authored by jlebar on Sep 15 2022, 8:05 PM.

Details

Reviewers
tra
nikic
Summary

Like absl::Cleanup, llvm::Cleanup runs an arbitrary function right
before the scope containing the Cleanup exits.

You can use this to do some work at the end of a function, right before
it returns.

This is used in a later patch.

Diff Detail

Event Timeline

jlebar created this revision.Sep 15 2022, 8:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 8:05 PM
Herald added a subscriber: mgorny. · View Herald Transcript
jlebar requested review of this revision.Sep 15 2022, 8:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 8:05 PM
nikic requested changes to this revision.Sep 16 2022, 12:48 AM
nikic added a subscriber: nikic.

Unless I'm missing something, this is already covered by make_scope_exit().

This revision now requires changes to proceed.Sep 16 2022, 12:48 AM
jlebar abandoned this revision.Sep 16 2022, 9:22 AM

Unless I'm missing something, this is already covered by make_scope_exit().

You are definitely not missing something. :) I looked through ADT before writing this patch, but clearly I did not look closely enough.

Thank you.