/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/ADT/ScopeExit.h
Line | Count | Source |
1 | | //===- llvm/ADT/ScopeExit.h - Execute code at scope exit --------*- C++ -*-===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This file defines the make_scope_exit function, which executes user-defined |
11 | | // cleanup logic at scope exit. |
12 | | // |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | #ifndef LLVM_ADT_SCOPE_EXIT_H |
16 | | #define LLVM_ADT_SCOPE_EXIT_H |
17 | | |
18 | | #include "llvm/Support/Compiler.h" |
19 | | |
20 | | #include <type_traits> |
21 | | #include <utility> |
22 | | |
23 | | namespace llvm { |
24 | | namespace detail { |
25 | | |
26 | | template <typename Callable> class scope_exit { |
27 | | Callable ExitFunction; |
28 | | |
29 | | public: |
30 | | template <typename Fp> |
31 | 11.0M | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} InstructionSelect.cpp:llvm::detail::scope_exit<llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&)::$_0>::scope_exit<llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&)::$_0>(llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&)::$_0&&) Line | Count | Source | 31 | 223k | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} |
IRTranslator.cpp:llvm::detail::scope_exit<llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)::$_2>::scope_exit<llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)::$_2>(llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)::$_2&&) Line | Count | Source | 31 | 222k | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} |
CGCoroutine.cpp:llvm::detail::scope_exit<emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool)::$_0>::scope_exit<emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool)::$_0>(emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool)::$_0&&) Line | Count | Source | 31 | 85 | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} |
LoopUtils.cpp:llvm::detail::scope_exit<llvm::formDedicatedExitBlocks(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, bool)::$_0::operator()(llvm::BasicBlock*) const::'lambda'()>::scope_exit<llvm::formDedicatedExitBlocks(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, bool)::$_0::operator()(llvm::BasicBlock*) const::'lambda'()>(llvm::formDedicatedExitBlocks(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, bool)::$_0::operator()(llvm::BasicBlock*) const::'lambda'()&&) Line | Count | Source | 31 | 4.19M | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} |
IfConversion.cpp:llvm::detail::scope_exit<(anonymous namespace)::IfConverter::ValidForkedDiamond((anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&, unsigned int&, unsigned int&, (anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&) const::$_1>::scope_exit<(anonymous namespace)::IfConverter::ValidForkedDiamond((anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&, unsigned int&, unsigned int&, (anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&) const::$_1>((anonymous namespace)::IfConverter::ValidForkedDiamond((anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&, unsigned int&, unsigned int&, (anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&) const::$_1&&) Line | Count | Source | 31 | 42 | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} |
ScalarEvolution.cpp:llvm::detail::scope_exit<llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, bool)::$_17>::scope_exit<llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, bool)::$_17>(llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, bool)::$_17&&) Line | Count | Source | 31 | 6.36M | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} |
LoopInfo.cpp:llvm::detail::scope_exit<llvm::LoopInfo::erase(llvm::Loop*)::$_3>::scope_exit<llvm::LoopInfo::erase(llvm::Loop*)::$_3>(llvm::LoopInfo::erase(llvm::Loop*)::$_3&&) Line | Count | Source | 31 | 43.1k | explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} |
|
32 | | |
33 | | scope_exit(scope_exit &&Rhs) : ExitFunction(std::move(Rhs.ExitFunction)) {} |
34 | | |
35 | 11.0M | ~scope_exit() { ExitFunction(); } LoopInfo.cpp:llvm::detail::scope_exit<llvm::LoopInfo::erase(llvm::Loop*)::$_3>::~scope_exit() Line | Count | Source | 35 | 43.1k | ~scope_exit() { ExitFunction(); } |
InstructionSelect.cpp:llvm::detail::scope_exit<llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&)::$_0>::~scope_exit() Line | Count | Source | 35 | 223k | ~scope_exit() { ExitFunction(); } |
ScalarEvolution.cpp:llvm::detail::scope_exit<llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, bool)::$_17>::~scope_exit() Line | Count | Source | 35 | 6.36M | ~scope_exit() { ExitFunction(); } |
IfConversion.cpp:llvm::detail::scope_exit<(anonymous namespace)::IfConverter::ValidForkedDiamond((anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&, unsigned int&, unsigned int&, (anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&) const::$_1>::~scope_exit() Line | Count | Source | 35 | 42 | ~scope_exit() { ExitFunction(); } |
LoopUtils.cpp:llvm::detail::scope_exit<llvm::formDedicatedExitBlocks(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, bool)::$_0::operator()(llvm::BasicBlock*) const::'lambda'()>::~scope_exit() Line | Count | Source | 35 | 4.19M | ~scope_exit() { ExitFunction(); } |
CGCoroutine.cpp:llvm::detail::scope_exit<emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool)::$_0>::~scope_exit() Line | Count | Source | 35 | 85 | ~scope_exit() { ExitFunction(); } |
IRTranslator.cpp:llvm::detail::scope_exit<llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)::$_2>::~scope_exit() Line | Count | Source | 35 | 222k | ~scope_exit() { ExitFunction(); } |
|
36 | | }; |
37 | | |
38 | | } // end namespace detail |
39 | | |
40 | | // Keeps the callable object that is passed in, and execute it at the |
41 | | // destruction of the returned object (usually at the scope exit where the |
42 | | // returned object is kept). |
43 | | // |
44 | | // Interface is specified by p0052r2. |
45 | | template <typename Callable> |
46 | | LLVM_NODISCARD detail::scope_exit<typename std::decay<Callable>::type> |
47 | 11.0M | make_scope_exit(Callable &&F) { |
48 | 11.0M | return detail::scope_exit<typename std::decay<Callable>::type>( |
49 | 11.0M | std::forward<Callable>(F)); |
50 | 11.0M | } ScalarEvolution.cpp:llvm::detail::scope_exit<std::__1::decay<llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, bool)::$_17>::type> llvm::make_scope_exit<llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, bool)::$_17>(llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, bool)::$_17&&) Line | Count | Source | 47 | 6.36M | make_scope_exit(Callable &&F) { | 48 | 6.36M | return detail::scope_exit<typename std::decay<Callable>::type>( | 49 | 6.36M | std::forward<Callable>(F)); | 50 | 6.36M | } |
InstructionSelect.cpp:llvm::detail::scope_exit<std::__1::decay<llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&)::$_0>::type> llvm::make_scope_exit<llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&)::$_0>(llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&)::$_0&&) Line | Count | Source | 47 | 223k | make_scope_exit(Callable &&F) { | 48 | 223k | return detail::scope_exit<typename std::decay<Callable>::type>( | 49 | 223k | std::forward<Callable>(F)); | 50 | 223k | } |
IRTranslator.cpp:llvm::detail::scope_exit<std::__1::decay<llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)::$_2>::type> llvm::make_scope_exit<llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)::$_2>(llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)::$_2&&) Line | Count | Source | 47 | 222k | make_scope_exit(Callable &&F) { | 48 | 222k | return detail::scope_exit<typename std::decay<Callable>::type>( | 49 | 222k | std::forward<Callable>(F)); | 50 | 222k | } |
CGCoroutine.cpp:llvm::detail::scope_exit<std::__1::decay<emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool)::$_0>::type> llvm::make_scope_exit<emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool)::$_0>(emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool)::$_0&&) Line | Count | Source | 47 | 85 | make_scope_exit(Callable &&F) { | 48 | 85 | return detail::scope_exit<typename std::decay<Callable>::type>( | 49 | 85 | std::forward<Callable>(F)); | 50 | 85 | } |
LoopInfo.cpp:llvm::detail::scope_exit<std::__1::decay<llvm::LoopInfo::erase(llvm::Loop*)::$_3>::type> llvm::make_scope_exit<llvm::LoopInfo::erase(llvm::Loop*)::$_3>(llvm::LoopInfo::erase(llvm::Loop*)::$_3&&) Line | Count | Source | 47 | 43.1k | make_scope_exit(Callable &&F) { | 48 | 43.1k | return detail::scope_exit<typename std::decay<Callable>::type>( | 49 | 43.1k | std::forward<Callable>(F)); | 50 | 43.1k | } |
IfConversion.cpp:llvm::detail::scope_exit<std::__1::decay<(anonymous namespace)::IfConverter::ValidForkedDiamond((anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&, unsigned int&, unsigned int&, (anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&) const::$_1>::type> llvm::make_scope_exit<(anonymous namespace)::IfConverter::ValidForkedDiamond((anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&, unsigned int&, unsigned int&, (anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&) const::$_1>((anonymous namespace)::IfConverter::ValidForkedDiamond((anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&, unsigned int&, unsigned int&, (anonymous namespace)::IfConverter::BBInfo&, (anonymous namespace)::IfConverter::BBInfo&) const::$_1&&) Line | Count | Source | 47 | 42 | make_scope_exit(Callable &&F) { | 48 | 42 | return detail::scope_exit<typename std::decay<Callable>::type>( | 49 | 42 | std::forward<Callable>(F)); | 50 | 42 | } |
LoopUtils.cpp:llvm::detail::scope_exit<std::__1::decay<llvm::formDedicatedExitBlocks(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, bool)::$_0::operator()(llvm::BasicBlock*) const::'lambda'()>::type> llvm::make_scope_exit<llvm::formDedicatedExitBlocks(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, bool)::$_0::operator()(llvm::BasicBlock*) const::'lambda'()>(llvm::formDedicatedExitBlocks(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, bool)::$_0::operator()(llvm::BasicBlock*) const::'lambda'()&&) Line | Count | Source | 47 | 4.19M | make_scope_exit(Callable &&F) { | 48 | 4.19M | return detail::scope_exit<typename std::decay<Callable>::type>( | 49 | 4.19M | std::forward<Callable>(F)); | 50 | 4.19M | } |
|
51 | | |
52 | | } // end namespace llvm |
53 | | |
54 | | #endif |