[PATCH] D110278: Adding doWithCleanup abstraction

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 22 12:01:09 PDT 2021


beanz created this revision.
beanz added reviewers: lhames, dblaikie.
Herald added subscribers: dexonsmith, mgorny.
beanz requested review of this revision.
Herald added projects: clang, LLVM.

This patch adds a new `doWithCleanup` abstraction to LLVM that works
with `llvm::Error`, `int`, `bool`, and <insert your own type here>
return types that propagate status.

This abstraction is a more general way of having a conditional cleanup
that can be used with multiple return paths out of a function.

Test cases and a first use case in clang are part of the patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110278

Files:
  clang/include/clang/Frontend/FrontendAction.h
  clang/lib/Frontend/FrontendAction.cpp
  llvm/include/llvm/Support/Cleanup.h
  llvm/unittests/Support/CMakeLists.txt
  llvm/unittests/Support/CleanupTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110278.374316.patch
Type: text/x-patch
Size: 9224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210922/f919daf9/attachment.bin>


More information about the cfe-commits mailing list