diff options
author | Jim Ingham <jingham@apple.com> | 2022-06-23 09:33:40 -0700 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2022-06-27 15:14:41 -0700 |
commit | c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a (patch) | |
tree | ed7886491e1a97d19af06525fca43987a3dfb0a9 /lldb/source/API/SBCommandInterpreter.cpp | |
parent | 6824eee94203b16de7633050367505c2ad10c56a (diff) | |
download | llvm-c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a.zip llvm-c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a.tar.gz llvm-c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a.tar.bz2 |
Have CommandObjectParsed check for "commands that take no arguments".
This is currently being done in an ad hoc way, and so for some
commands it isn't being checked. We have the info to make this check,
since commands are supposed to add their arguments to the m_arguments
field of the CommandObject. This change uses that info to check whether
the command received arguments in error.
A handful of commands weren't defining their argument types, I also had
to fix them. And a bunch of commands were checking for arguments by
hand, so I removed those checks in favor of the CommandObject one. That
also meant I had to change some tests that were checking for the ad hoc
error outputs.
Differential Revision: https://reviews.llvm.org/D128453
Diffstat (limited to 'lldb/source/API/SBCommandInterpreter.cpp')
-rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index a19ad48..aa46f10 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -47,6 +47,10 @@ public: auto_repeat_command == nullptr ? llvm::None : llvm::Optional<std::string>(auto_repeat_command); + // We don't know whether any given command coming from this interface takes + // arguments or not so here we're just disabling the basic args check. + CommandArgumentData none_arg{eArgTypeNone, eArgRepeatStar}; + m_arguments.push_back({none_arg}); } bool IsRemovable() const override { return true; } |