Skip to content

Commit 80bd72b

Browse files
[lldb][nfc] Use delegating ctor for ExecutionContext (#151987)
The ctor that takes a reference to ExecutionContextRef can be implemented in terms of the ctor that takes a pointer to that object, removing code duplication.
1 parent 7b208e0 commit 80bd72b

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

lldb/include/lldb/Target/ExecutionContext.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ class ExecutionContext {
318318
// These two variants take in a locker, and grab the target, lock the API
319319
// mutex into locker, then fill in the rest of the shared pointers.
320320
ExecutionContext(const ExecutionContextRef &exe_ctx_ref,
321-
std::unique_lock<std::recursive_mutex> &locker);
321+
std::unique_lock<std::recursive_mutex> &locker)
322+
: ExecutionContext(&exe_ctx_ref, locker) {}
323+
322324
ExecutionContext(const ExecutionContextRef *exe_ctx_ref,
323325
std::unique_lock<std::recursive_mutex> &locker);
324326
// Create execution contexts from execution context scopes

lldb/source/Target/ExecutionContext.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,6 @@ ExecutionContext::ExecutionContext(const ExecutionContextRef *exe_ctx_ref_ptr,
140140
}
141141
}
142142

143-
ExecutionContext::ExecutionContext(const ExecutionContextRef &exe_ctx_ref,
144-
std::unique_lock<std::recursive_mutex> &lock)
145-
: m_target_sp(exe_ctx_ref.GetTargetSP()), m_process_sp(), m_thread_sp(),
146-
m_frame_sp() {
147-
if (m_target_sp) {
148-
lock = std::unique_lock<std::recursive_mutex>(m_target_sp->GetAPIMutex());
149-
150-
m_process_sp = exe_ctx_ref.GetProcessSP();
151-
m_thread_sp = exe_ctx_ref.GetThreadSP();
152-
m_frame_sp = exe_ctx_ref.GetFrameSP();
153-
}
154-
}
155-
156143
ExecutionContext::ExecutionContext(ExecutionContextScope *exe_scope_ptr)
157144
: m_target_sp(), m_process_sp(), m_thread_sp(), m_frame_sp() {
158145
if (exe_scope_ptr)

0 commit comments

Comments
 (0)