Author: Jonas Devlieghere Date: 2025-08-04T09:37:37-07:00 New Revision: 8f77fa7026de9f544778063fd9fe900d0804b863
URL: https://github.com/llvm/llvm-project/commit/8f77fa7026de9f544778063fd9fe900d0804b863 DIFF: https://github.com/llvm/llvm-project/commit/8f77fa7026de9f544778063fd9fe900d0804b863.diff LOG: [lldb] Simplify Python Locker log messages (NFC) Eliminate the `log` variable by inlining the GetLog call and use "locked" and "unlocked" directly, as requested by Ismail in #151780. Added: Modified: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index fc4df818108c6..adc172c4a3744 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -145,15 +145,15 @@ struct InitializePythonRAII { m_was_already_initialized = true; m_gil_state = PyGILState_Ensure(); LLDB_LOGV(GetLog(LLDBLog::Script), - "Ensured PyGILState. Previous state = {0}locked\n", - m_gil_state == PyGILState_UNLOCKED ? "un" : ""); + "Ensured PyGILState. Previous state = {0}", + m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked"); } ~InitializePythonRAII() { if (m_was_already_initialized) { - Log *log = GetLog(LLDBLog::Script); - LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", - m_gil_state == PyGILState_UNLOCKED ? "un" : ""); + LLDB_LOGV(GetLog(LLDBLog::Script), + "Releasing PyGILState. Returning to state = {0}", + m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked"); PyGILState_Release(m_gil_state); } else { // We initialized the threads in this function, just unlock the GIL. @@ -328,10 +328,9 @@ ScriptInterpreterPythonImpl::Locker::Locker( } bool ScriptInterpreterPythonImpl::Locker::DoAcquireLock() { - Log *log = GetLog(LLDBLog::Script); m_GILState = PyGILState_Ensure(); - LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked", - m_GILState == PyGILState_UNLOCKED ? "un" : ""); + LLDB_LOGV(GetLog(LLDBLog::Script), "Ensured PyGILState. Previous state = {0}", + m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked"); // we need to save the thread state when we first start the command because // we might decide to interrupt it while some action is taking place outside @@ -352,9 +351,9 @@ bool ScriptInterpreterPythonImpl::Locker::DoInitSession(uint16_t on_entry_flags, } bool ScriptInterpreterPythonImpl::Locker::DoFreeLock() { - Log *log = GetLog(LLDBLog::Script); - LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", - m_GILState == PyGILState_UNLOCKED ? "un" : ""); + LLDB_LOGV(GetLog(LLDBLog::Script), + "Releasing PyGILState. Returning to state = {0}", + m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked"); PyGILState_Release(m_GILState); m_python_interpreter->DecrementLockCount(); return true; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits