Author: Med Ismail Bennani
Date: 2023-01-12T12:49:05-08:00
New Revision: 3fbc89048517e7152cce763db3b1e5738d558113

URL: 
https://github.com/llvm/llvm-project/commit/3fbc89048517e7152cce763db3b1e5738d558113
DIFF: 
https://github.com/llvm/llvm-project/commit/3fbc89048517e7152cce763db3b1e5738d558113.diff

LOG: [lldb/Interpreter] Improve ScriptedPythonInterface::GetStatusFromMethod

This patch makes `ScriptedPythonInterface::GetStatusFromMethod` take a
parameter pack as an argument. That will allow it to pass arbitrary
arguments to the python method.

Differential Revision: https://reviews.llvm.org/D139248

Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com>

Added: 
    

Modified: 
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
index 10c22df5475d4..789b39abf5878 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
@@ -27,14 +27,6 @@ ScriptedPythonInterface::ScriptedPythonInterface(
     ScriptInterpreterPythonImpl &interpreter)
     : ScriptedInterface(), m_interpreter(interpreter) {}
 
-Status
-ScriptedPythonInterface::GetStatusFromMethod(llvm::StringRef method_name) {
-  Status error;
-  Dispatch<Status>(method_name, error);
-
-  return error;
-}
-
 template <>
 StructuredData::ArraySP
 ScriptedPythonInterface::ExtractValueFromPythonObject<StructuredData::ArraySP>(

diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
index cc936e09a6ef2..01dc07b497376 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
@@ -100,7 +100,13 @@ class ScriptedPythonInterface : virtual public 
ScriptedInterface {
     return ExtractValueFromPythonObject<T>(py_return, error);
   }
 
-  Status GetStatusFromMethod(llvm::StringRef method_name);
+  template <typename... Args>
+  Status GetStatusFromMethod(llvm::StringRef method_name, Args &&...args) {
+    Status error;
+    Dispatch<Status>(method_name, error, std::forward<Args>(args)...);
+
+    return error;
+  }
 
   template <typename T> T Transform(T object) {
     // No Transformation for generic usage


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

Reply via email to