File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
llvm/lib/Transforms/Coroutines Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 16
16
17
17
#include " CoroInternal.h"
18
18
#include " llvm/ADT/BitVector.h"
19
+ #include " llvm/ADT/ScopeExit.h"
19
20
#include " llvm/ADT/SmallString.h"
20
21
#include " llvm/Analysis/PtrUseVisitor.h"
21
22
#include " llvm/Analysis/StackLifetime.h"
@@ -576,13 +577,8 @@ void FrameTypeBuilder::addFieldForAllocas(const Function &F,
576
577
using AllocaSetType = SmallVector<AllocaInst *, 4 >;
577
578
SmallVector<AllocaSetType, 4 > NonOverlapedAllocas;
578
579
579
- // We need to add field for allocas at the end of this function. However, this
580
- // function has multiple exits, so we use this helper to avoid redundant code.
581
- struct RTTIHelper {
582
- std::function<void ()> func;
583
- RTTIHelper (std::function<void ()> &&func) : func(func) {}
584
- ~RTTIHelper () { func (); }
585
- } Helper ([&]() {
580
+ // We need to add field for allocas at the end of this function.
581
+ auto AddFieldForAllocasAtExit = make_scope_exit ([&]() {
586
582
for (auto AllocaList : NonOverlapedAllocas) {
587
583
auto *LargestAI = *AllocaList.begin ();
588
584
FieldIDType Id = addFieldForAlloca (LargestAI);
You can’t perform that action at this time.
0 commit comments