forked from OSchip/llvm-project
Replace local utility class OnExit with llvm::scope_exit (NFC)
llvm-svn: 359319
This commit is contained in:
parent
354247c08d
commit
edebf12acf
|
@ -56,6 +56,8 @@
|
|||
#include "clang/AST/DeclCXX.h"
|
||||
#include "clang/AST/DeclObjC.h"
|
||||
|
||||
#include "llvm/ADT/ScopeExit.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
|
||||
ClangUserExpression::ClangUserExpression(
|
||||
|
@ -328,21 +330,6 @@ static void ApplyObjcCastHack(std::string &expr) {
|
|||
#undef OBJC_CAST_HACK_FROM
|
||||
}
|
||||
|
||||
namespace {
|
||||
// Utility guard that calls a callback when going out of scope.
|
||||
class OnExit {
|
||||
public:
|
||||
typedef std::function<void(void)> Callback;
|
||||
|
||||
OnExit(Callback const &callback) : m_callback(callback) {}
|
||||
|
||||
~OnExit() { m_callback(); }
|
||||
|
||||
private:
|
||||
Callback m_callback;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
bool ClangUserExpression::SetupPersistentState(DiagnosticManager &diagnostic_manager,
|
||||
ExecutionContext &exe_ctx) {
|
||||
if (Target *target = exe_ctx.GetTargetPtr()) {
|
||||
|
@ -560,7 +547,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
|
|||
|
||||
ResetDeclMap(exe_ctx, m_result_delegate, keep_result_in_memory);
|
||||
|
||||
OnExit on_exit([this]() { ResetDeclMap(); });
|
||||
auto on_exit = llvm::make_scope_exit([this]() { ResetDeclMap(); });
|
||||
|
||||
if (!DeclMap()->WillParse(exe_ctx, m_materializer_up.get())) {
|
||||
diagnostic_manager.PutString(
|
||||
|
@ -748,7 +735,7 @@ bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,
|
|||
|
||||
ResetDeclMap(exe_ctx, m_result_delegate, /*keep result in memory*/ true);
|
||||
|
||||
OnExit on_exit([this]() { ResetDeclMap(); });
|
||||
auto on_exit = llvm::make_scope_exit([this]() { ResetDeclMap(); });
|
||||
|
||||
if (!DeclMap()->WillParse(exe_ctx, m_materializer_up.get())) {
|
||||
diagnostic_manager.PutString(
|
||||
|
|
Loading…
Reference in New Issue