[Lldb-commits] [lldb] [lldb] Use if-with-initializer pattern in SBTarget (NFC) (PR #141284)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue May 27 05:39:02 PDT 2025


================
@@ -723,22 +703,23 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation(
   LLDB_INSTRUMENT_VA(this, sb_file_spec, line, column, offset, sb_module_list);
 
   SBBreakpoint sb_bp;
-  TargetSP target_sp(GetSP());
-  if (target_sp && line != 0) {
-    std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
-
-    const LazyBool check_inlines = eLazyBoolCalculate;
-    const LazyBool skip_prologue = eLazyBoolCalculate;
-    const bool internal = false;
-    const bool hardware = false;
-    const LazyBool move_to_nearest_code = eLazyBoolCalculate;
-    const FileSpecList *module_list = nullptr;
-    if (sb_module_list.GetSize() > 0) {
-      module_list = sb_module_list.get();
+  if (TargetSP target_sp = GetSP()) {
+    if (line != 0) {
----------------
labath wrote:

```suggestion
  if (TargetSP target_sp = GetSP(); target_sp && line != 0) {
```

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


More information about the lldb-commits mailing list