[Lldb-commits] [lldb] [lldb] Wrap Target::GetAPIMutex() into a Lockable handle (NFC) (PR #212872)

via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 3 03:17:29 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- lldb/include/lldb/Target/TargetAPILock.h lldb/unittests/Target/TargetAPILockTest.cpp lldb/include/lldb/API/SBMutex.h lldb/include/lldb/Interpreter/CommandObject.h lldb/include/lldb/Target/ExecutionContext.h lldb/include/lldb/Target/Target.h lldb/include/lldb/ValueObject/ValueObject.h lldb/source/API/SBAddress.cpp lldb/source/API/SBBreakpoint.cpp lldb/source/API/SBBreakpointLocation.cpp lldb/source/API/SBBreakpointName.cpp lldb/source/API/SBCommandInterpreter.cpp lldb/source/API/SBDebugger.cpp lldb/source/API/SBFunction.cpp lldb/source/API/SBInstruction.cpp lldb/source/API/SBMutex.cpp lldb/source/API/SBProcess.cpp lldb/source/API/SBSymbol.cpp lldb/source/API/SBTarget.cpp lldb/source/API/SBThread.cpp lldb/source/API/SBValue.cpp lldb/source/API/SBWatchpoint.cpp lldb/source/Interpreter/CommandObject.cpp lldb/source/Target/ExecutionContext.cpp lldb/source/Target/Target.cpp lldb/source/ValueObject/ValueObject.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/include/lldb/Target/ExecutionContext.h b/lldb/include/lldb/Target/ExecutionContext.h
index e63b58537..3379b5ea5 100644
--- a/lldb/include/lldb/Target/ExecutionContext.h
+++ b/lldb/include/lldb/Target/ExecutionContext.h
@@ -569,8 +569,7 @@ struct StoppedExecutionContext : ExecutionContext {
   StoppedExecutionContext(lldb::TargetSP &target_sp,
                           lldb::ProcessSP &process_sp,
                           lldb::ThreadSP &thread_sp,
-                          lldb::StackFrameSP &frame_sp,
-                          TargetAPILock api_lock,
+                          lldb::StackFrameSP &frame_sp, TargetAPILock api_lock,
                           ProcessRunLock::ProcessRunLocker stop_locker)
       : m_api_lock(std::move(api_lock)), m_stop_locker(std::move(stop_locker)) {
     assert(target_sp);
diff --git a/lldb/source/API/SBMutex.cpp b/lldb/source/API/SBMutex.cpp
index 244f89972..b7f1f793b 100644
--- a/lldb/source/API/SBMutex.cpp
+++ b/lldb/source/API/SBMutex.cpp
@@ -45,8 +45,7 @@ const SBMutex &SBMutex::operator=(const SBMutex &rhs) {
 }
 
 SBMutex::SBMutex(lldb::TargetSP target_sp)
-    : m_opaque_sp(
-          std::make_shared<TargetAPILock>(target_sp->GetAPIMutex())) {
+    : m_opaque_sp(std::make_shared<TargetAPILock>(target_sp->GetAPIMutex())) {
   LLDB_INSTRUMENT_VA(this, target_sp);
 }
 
diff --git a/lldb/unittests/Target/TargetAPILockTest.cpp b/lldb/unittests/Target/TargetAPILockTest.cpp
index 0bbc42812..ea26a0f49 100644
--- a/lldb/unittests/Target/TargetAPILockTest.cpp
+++ b/lldb/unittests/Target/TargetAPILockTest.cpp
@@ -102,7 +102,9 @@ TEST(TargetAPILockTest, DestructorReleasesIfLocked) {
 
 TEST(TargetAPILockTest, DestructorIsANoOpIfNeverLocked) {
   std::recursive_mutex mutex;
-  { TargetAPILock lock(mutex); }
+  {
+    TargetAPILock lock(mutex);
+  }
 
   std::thread t([&mutex]() {
     TargetAPILock background_lock(mutex);

``````````

</details>


https://github.com/llvm/llvm-project/pull/212872


More information about the lldb-commits mailing list