diff options
author | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-19 07:05:39 +0000 |
---|---|---|
committer | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-19 07:05:39 +0000 |
commit | bdcad0aca0a05145364ee153a8f54af4aea2c445 (patch) | |
tree | c5985bd6416163194f833c3a48a45458429d242a /lldb/scripts | |
parent | 2386537c2469a97501a305c6b3138231b907a67f (diff) | |
download | llvm-bdcad0aca0a05145364ee153a8f54af4aea2c445.tar.gz |
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
Diffstat (limited to 'lldb/scripts')
-rw-r--r-- | lldb/scripts/Python/python-wrapper.swig | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index c50f9d1fab92..277b8657d344 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(); |