summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 2e64b088539..8e08d4d7554 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -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(
OpenPOWER on IntegriCloud