aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectSource.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2022-06-23 09:33:40 -0700
committerJim Ingham <jingham@apple.com>2022-06-27 15:14:41 -0700
commitc1b07d617705dfdb3aabbdda51c1a40d99f7cc1a (patch)
treeed7886491e1a97d19af06525fca43987a3dfb0a9 /lldb/source/Commands/CommandObjectSource.cpp
parent6824eee94203b16de7633050367505c2ad10c56a (diff)
downloadllvm-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/Commands/CommandObjectSource.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index 67286c2..f879818 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -538,14 +538,6 @@ protected:
}
bool DoExecute(Args &command, CommandReturnObject &result) override {
- const size_t argc = command.GetArgumentCount();
-
- if (argc != 0) {
- result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n",
- GetCommandName().str().c_str());
- return false;
- }
-
Target *target = m_exe_ctx.GetTargetPtr();
if (target == nullptr) {
target = GetDebugger().GetSelectedTarget().get();
@@ -924,14 +916,6 @@ protected:
}
bool DoExecute(Args &command, CommandReturnObject &result) override {
- const size_t argc = command.GetArgumentCount();
-
- if (argc != 0) {
- result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n",
- GetCommandName().str().c_str());
- return false;
- }
-
Target *target = m_exe_ctx.GetTargetPtr();
if (!m_options.symbol_name.empty()) {