https://github.com/xgupta updated 
https://github.com/llvm/llvm-project/pull/94779

>From b8a387d82ed90c98f6bc9c0c7f9bc9da0d8e4d18 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98....@gmail.com>
Date: Fri, 7 Jun 2024 23:21:15 +0530
Subject: [PATCH 1/3] [LLDB][NFC] Fix a cppcheck warning in
 Python/Interfaces/ScriptedPythonInterface.h

Fix #89195
---
 .../Python/Interfaces/ScriptedPythonInterface.h                 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
 
b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
index 163659234466d..30811639c9a95 100644
--- 
a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
+++ 
b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
@@ -85,7 +85,7 @@ class ScriptedPythonInterface : virtual public 
ScriptedInterface {
     bool has_class_name = !class_name.empty();
     bool has_interpreter_dict =
         !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty());
-    if (!has_class_name && !has_interpreter_dict && !script_obj) {
+    if (!has_class_name || !has_interpreter_dict || !script_obj) {
       if (!has_class_name)
         return create_error("Missing script class name.");
       else if (!has_interpreter_dict)

>From 7a53eeb7c42c79f7637a8900a02e782f385d494f Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98....@gmail.com>
Date: Wed, 19 Jun 2024 13:46:57 +0530
Subject: [PATCH 2/3] simplify condition

---
 .../Interfaces/ScriptedPythonInterface.h       | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
 
b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
index 30811639c9a95..3d7c640a686ae 100644
--- 
a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
+++ 
b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
@@ -85,13 +85,17 @@ class ScriptedPythonInterface : virtual public 
ScriptedInterface {
     bool has_class_name = !class_name.empty();
     bool has_interpreter_dict =
         !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty());
-    if (!has_class_name || !has_interpreter_dict || !script_obj) {
-      if (!has_class_name)
-        return create_error("Missing script class name.");
-      else if (!has_interpreter_dict)
-        return create_error("Invalid script interpreter dictionary.");
-      else
-        return create_error("Missing scripting object.");
+
+    if (!has_class_name) {
+      return create_error("Missing script class name.");
+    }
+
+    if (!has_interpreter_dict) {
+      return create_error("Invalid script interpreter dictionary.");
+    }
+
+    if (!script_obj) {
+      return create_error("Missing scripting object.");
     }
 
     Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN,

>From 93a6edb2e5cfeca2eccbc6b70ad8a06476c99210 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivma98....@gmail.com>
Date: Sat, 6 Jul 2024 09:21:30 +0200
Subject: [PATCH 3/3] address review comment

---
 .../Python/Interfaces/ScriptedPythonInterface.h          | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
 
b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
index 3d7c640a686ae..9e859ec4b3653 100644
--- 
a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
+++ 
b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
@@ -86,17 +86,14 @@ class ScriptedPythonInterface : virtual public 
ScriptedInterface {
     bool has_interpreter_dict =
         !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty());
 
-    if (!has_class_name) {
+    if (!has_class_name)
       return create_error("Missing script class name.");
-    }
 
-    if (!has_interpreter_dict) {
+    if (!has_interpreter_dict)
       return create_error("Invalid script interpreter dictionary.");
-    }
 
-    if (!script_obj) {
+    if (!script_obj)
       return create_error("Missing scripting object.");
-    }
 
     Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN,
                    Locker::FreeLock);

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to