[Lldb-commits] [PATCH] D69469: [LLDB][formatters] ArgInfo::count -> ArgInfo::max_positional_args

Lawrence D'Anna via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Oct 27 18:08:37 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG40b0fa7ef212: [LLDB][formatters] ArgInfo::count -> ArgInfo::max_positional_args (authored by lawrence_danna).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69469/new/

https://reviews.llvm.org/D69469

Files:
  lldb/scripts/Python/python-wrapper.swig


Index: lldb/scripts/Python/python-wrapper.swig
===================================================================
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -495,11 +495,17 @@
     if (!pfunc.IsAllocated())
         return 0;
 
+    auto arg_info = pfunc.GetArgInfo();
+    if (!arg_info) {
+        llvm::consumeError(arg_info.takeError());
+        return 0;
+    }
+
     PythonObject result;
-    auto argc = pfunc.GetNumArguments();
-    if (argc.count == 1)
+
+    if (arg_info.get().max_positional_args < 1)
         result = pfunc();
-    else if (argc.count == 2)
+    else
         result = pfunc(PythonInteger(max));
 
     if (!result.IsAllocated())
@@ -511,13 +517,13 @@
 
     size_t ret_val = int_result.GetInteger();
 
-    if (PyErr_Occurred())
+    if (PyErr_Occurred()) //FIXME use Expected to catch python exceptions
     {
         PyErr_Print();
         PyErr_Clear();
     }
 
-    if (argc.count == 1)
+    if (arg_info.get().max_positional_args < 1)
         ret_val = std::min(ret_val, static_cast<size_t>(max));
 
     return ret_val;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69469.226605.patch
Type: text/x-patch
Size: 1112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191028/d5052986/attachment.bin>


More information about the lldb-commits mailing list