From bdcad0aca0a05145364ee153a8f54af4aea2c445 Mon Sep 17 00:00:00 2001 From: Lawrence D'Anna Date: Sat, 19 Oct 2019 07:05:39 +0000 Subject: convert LLDBSwigPythonCallTypeScript to ArgInfo::max_positional_args Summary: This patch converts another user of ArgInfo::count over to use ArgInfo::max_positional_args instead. I also add a test to make sure both documented signatures for python type formatters work. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69153 llvm-svn: 375334 --- lldb/scripts/Python/python-wrapper.swig | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lldb/scripts/Python') diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index c50f9d1..277b865 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -163,14 +163,19 @@ LLDBSwigPythonCallTypeScript } PythonObject result; - auto argc = pfunc.GetNumArguments(); - // if the third argument is supported, or varargs are allowed + auto argc = pfunc.GetArgInfo(); + if (!argc) { + llvm::consumeError(argc.takeError()); + return false; + } + PythonObject value_arg(PyRefType::Owned, SBTypeToSWIGWrapper(sb_value)); PythonObject options_arg(PyRefType::Owned, SBTypeToSWIGWrapper(sb_options)); - if (argc.count == 3 || argc.has_varargs) - result = pfunc(value_arg,dict,options_arg); - else + + if (argc.get().max_positional_args < 3) result = pfunc(value_arg,dict); + else + result = pfunc(value_arg,dict,options_arg); retval = result.Str().GetString().str(); -- cgit v1.1