llvm-project/lldb/source/Interpreter
Pavel Labath 1abaeece71 Options: Reduce code duplication
Summary:
While investigating breakages caused by D63110, I noticed we were
building the short options strings in three places. Some of them used a
leading ':' to detect missing arguments, and some didn't. This was the
indirect cause of D63110. Here, I move the common code into a utility
function.

Also, unify the code which appends the sentinel value at the end of the
option vector, and make it harder for users to pass invalid argc-argv
combos to getopt (another component of D63110) by having the
OptionParser::Parse function take a (Mutable)ArrayRef.

This unification has uncovered that we don't handle missing arguments
while building aliases, However, it's not possible to write an effective
test for this, as right now it is not possible to return an error out of
the alias parsing code (which means we are printing the generic
"failure" message even after this patch).

Reviewers: mgorny, aprantl

Reviewed By: mgorny

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D63770

llvm-svn: 365665
2019-07-10 17:09:47 +00:00
..
CMakeLists.txt build: add libedit to include paths 2018-09-21 18:34:41 +00:00
CommandAlias.cpp Options: Reduce code duplication 2019-07-10 17:09:47 +00:00
CommandHistory.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommandInterpreter.cpp Fix a typo in help text. 2019-06-25 23:13:16 +00:00
CommandObject.cpp Replace assert with static_assert here applicable. 2019-05-15 05:39:41 +00:00
CommandObjectRegexCommand.cpp [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
CommandObjectScript.cpp [ScriptInterpreter] Move ownership into debugger (NFC) 2019-04-26 22:43:16 +00:00
CommandObjectScript.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
CommandOptionValidators.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommandReturnObject.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionArgParser.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupArchitecture.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupBoolean.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupFile.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupFormat.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupOutputFile.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupPlatform.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupString.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupUInt64.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupUUID.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupValueObjectDisplay.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupVariable.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionGroupWatchpoint.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValue.cpp [lldb] NFC modernize codebase with modernize-use-nullptr 2019-05-23 11:14:47 +00:00
OptionValueArch.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueArgs.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueArray.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueBoolean.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueChar.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueDictionary.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
OptionValueEnumeration.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueFileSpec.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueFileSpecLIst.cpp Actaully lock accesses to OptionValueFileSpecList objects 2019-05-22 21:58:52 +00:00
OptionValueFormat.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueFormatEntity.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueLanguage.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValuePathMappings.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueProperties.cpp [NFC] find_first_of/find_last_of -> find/rfind for single char. 2019-03-28 18:10:14 +00:00
OptionValueRegex.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueSInt64.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueString.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueUInt64.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OptionValueUUID.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Options.cpp Options: Reduce code duplication 2019-07-10 17:09:47 +00:00
Property.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
ScriptInterpreter.cpp [ScriptInterpreter] Pass the debugger instead of the command interpreter 2019-04-26 17:58:19 +00:00
embedded_interpreter.py [Python] Flush prompt before reading input 2019-06-25 17:27:38 +00:00