diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-08-22 08:08:05 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-08-22 08:08:05 +0000 |
commit | 36162014c4697c30af588197d7cdeb8d2930abbf (patch) | |
tree | 48d8af920c8b27c9d20c12400ae1eb62c4ff830f /lldb/source/Commands | |
parent | ae34ed2c0d2fba36d8363ba7fffc1dbe18878335 (diff) | |
download | bcm5719-llvm-36162014c4697c30af588197d7cdeb8d2930abbf.tar.gz bcm5719-llvm-36162014c4697c30af588197d7cdeb8d2930abbf.zip |
[lldb][NFC] Remove dead code that is supposed to handle invalid command options
Summary:
We currently have a bunch of code that is supposed to handle invalid command options, but
all this code is unreachable because invalid options are already handled in `Options::Parse`.
The only way we can reach this code is when we declare but then not implement an option
(which will be made impossible with D65386, which is also when we can completely remove
the `default` cases).
This patch replaces all this code with `llvm_unreachable` to make clear this is dead code
that can't be reached.
Reviewers: JDevlieghere
Reviewed By: JDevlieghere
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66522
llvm-svn: 369625
Diffstat (limited to 'lldb/source/Commands')
19 files changed, 74 insertions, 199 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index 079e853de39..48a1a6a9ed5 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -141,9 +141,7 @@ public: } break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -206,9 +204,7 @@ public: m_use_dummy = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -486,9 +482,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1208,9 +1202,7 @@ public: m_internal = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1342,9 +1334,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1496,9 +1486,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1643,9 +1631,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -1713,7 +1699,8 @@ public: "invalid boolean value '%s' passed for -L option", option_arg.str().c_str()); } break; - + default: + llvm_unreachable("Unimplemented option"); } return error; @@ -2175,9 +2162,7 @@ public: break; } default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -2293,9 +2278,7 @@ public: m_append = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 81d449d1d7d..afb4fc4da1e 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -324,7 +324,7 @@ are no syntax errors may indicate that a function was declared but never called. break; default: - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -516,9 +516,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 4eb438f2b96..11fed6edf32 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -85,9 +85,7 @@ protected: m_clear.SetOptionWasSet(); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -253,9 +251,7 @@ protected: break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -370,9 +366,7 @@ protected: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1161,9 +1155,7 @@ private: m_syntax.assign(option_arg); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1414,9 +1406,7 @@ protected: m_allow_reload = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1568,9 +1558,7 @@ protected: option_arg.str().c_str()); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index 8a781a75fbe..924c99bca53 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -147,9 +147,7 @@ Status CommandObjectDisassemble::CommandOptions::SetOptionValue( } break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 79003d324c6..752c8f642e3 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -166,9 +166,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue( } default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 6cbf341d674..4be72c5681b 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -92,9 +92,7 @@ public: } break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -257,9 +255,7 @@ public: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -763,9 +759,7 @@ private: m_regex = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectHelp.h b/lldb/source/Commands/CommandObjectHelp.h index 826cd1e18a8..52a00ac79ff 100644 --- a/lldb/source/Commands/CommandObjectHelp.h +++ b/lldb/source/Commands/CommandObjectHelp.h @@ -52,9 +52,7 @@ public: m_show_hidden = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 2a591d26e04..ae8b175ef74 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -113,9 +113,7 @@ public: log_options |= LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 7fb567d5fe7..57ff00f3aa0 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -96,9 +96,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -936,9 +934,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -1226,9 +1222,7 @@ public: } break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 4d0b02ad39b..c1e78d703d7 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -117,8 +117,7 @@ public: m_permissions |= lldb::eFilePermissionsWorldExecute; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -632,9 +631,7 @@ protected: option_arg.str().c_str()); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -718,9 +715,7 @@ protected: m_data.assign(option_arg); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1270,9 +1265,7 @@ protected: break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1426,9 +1419,7 @@ public: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -1587,9 +1578,7 @@ public: timeout = std::chrono::seconds(timeout_sec); break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 620be4e5586..10af1a35872 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -307,9 +307,7 @@ public: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -538,9 +536,7 @@ protected: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -688,9 +684,7 @@ public: } break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -775,9 +769,7 @@ public: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -896,9 +888,7 @@ public: install_path.SetFile(option_arg, FileSpec::Style::native); break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -1277,9 +1267,7 @@ public: pass = option_arg; break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index 2b38de8584b..eedfe3ca0bf 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -272,9 +272,7 @@ protected: break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index b9a7b64f91c..05e8ec919de 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -104,9 +104,7 @@ insert-before or insert-after."); m_global = true; break; default: - error.SetErrorStringWithFormat("unrecognized options '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -355,9 +353,7 @@ public: m_append = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -456,9 +452,7 @@ public: m_filename.assign(option_arg); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 417dedc065e..de82e25a926 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -82,9 +82,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed { modules.push_back(std::string(option_arg)); break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -683,9 +681,7 @@ class CommandObjectSourceList : public CommandObjectParsed { reverse = true; break; default: - error.SetErrorStringWithFormat("unrecognized short option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 325926373a4..5630cedfaf2 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2010,9 +2010,7 @@ public: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -3356,8 +3354,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized option %c.", short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -3706,6 +3703,8 @@ public: case 'r': m_use_regex = true; break; + default: + llvm_unreachable("Unimplemented option"); } return error; @@ -4573,8 +4572,7 @@ public: break; default: - error.SetErrorStringWithFormat("unrecognized option %c.", short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 55d0d3fd2f6..2edba1d8da1 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -281,9 +281,7 @@ public: "invalid boolean value for option '%c'", short_option); } break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -485,9 +483,7 @@ public: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -1037,9 +1033,7 @@ public: } } break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -1426,7 +1420,7 @@ public: break; default: - return Status("invalid short option character '%c'", short_option); + llvm_unreachable("Unimplemented option"); } return error; } @@ -1560,9 +1554,7 @@ public: } } break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } @@ -1744,7 +1736,7 @@ public: m_force = true; break; default: - return Status("invalid short option character '%c'", short_option); + llvm_unreachable("Unimplemented option"); } return error; } @@ -1866,9 +1858,7 @@ public: m_verbose = true; break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; } diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 0fe82b88c6c..5ba2a57dcc8 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -323,9 +323,7 @@ private: m_regex = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -548,9 +546,7 @@ private: m_custom_type_name.assign(option_value); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -736,9 +732,7 @@ protected: m_language = Language::GetLanguageTypeFromString(option_arg); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -867,9 +861,7 @@ private: m_delete_all = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -987,9 +979,7 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed { m_category_language.SetOptionWasSet(); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1240,8 +1230,7 @@ Status CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue( m_flags.SetHideItemNames(true); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1739,9 +1728,7 @@ class CommandObjectTypeCategoryDefine : public CommandObjectParsed { error = m_cate_language.SetValueFromString(option_arg); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -1839,9 +1826,7 @@ class CommandObjectTypeCategoryEnable : public CommandObjectParsed { } break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -2008,9 +1993,7 @@ class CommandObjectTypeCategoryDisable : public CommandObjectParsed { } break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -2432,9 +2415,7 @@ private: m_regex = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -2687,9 +2668,7 @@ protected: break; default: - error.SetErrorStringWithFormat("invalid short option character '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index a7097af3f4f..5ddec476930 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -196,9 +196,7 @@ public: m_level = lldb::eDescriptionLevelVerbose; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -545,9 +543,7 @@ public: option_arg.str().c_str()); break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; @@ -666,9 +662,7 @@ public: m_condition_passed = true; break; default: - error.SetErrorStringWithFormat("unrecognized option '%c'", - short_option); - break; + llvm_unreachable("Unimplemented option"); } return error; diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index 5399f46cd11..e0a3bb88325 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -354,7 +354,7 @@ are no syntax errors may indicate that a function was declared but never called. break; default: - break; + llvm_unreachable("Unimplemented option"); } return error; } |