Refactor parsing of option lists with a raw string suffix.
authorRaphael Isemann <teemperor@gmail.com>
Tue, 10 Jul 2018 20:17:38 +0000 (20:17 +0000)
committerRaphael Isemann <teemperor@gmail.com>
Tue, 10 Jul 2018 20:17:38 +0000 (20:17 +0000)
commit3a0e12700bc775be452cf40f9226e535683864b7
tree30cdbbb9b4db69ff611c07f2c3c7ac4b4dabc0cd
parent01ce144ddf03df18c2259eb2d6e827511c0068c8
Refactor parsing of option lists with a raw string suffix.

Summary:
A subset of the LLDB commands follows this command line interface style:
   <command name> [arguments] -- <string suffix>
The parsing code for this interface has been so far been duplicated into the different
command objects which makes it hard to maintain and reuse elsewhere.

This patches improves the situation by adding a OptionsWithRaw class that centralizes
the parsing logic and allows easier testing. The different commands now just call this class to
extract the arguments and the raw suffix from the provided user input.

Reviewers: jingham

Reviewed By: jingham

Subscribers: mgorny, lldb-commits

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

llvm-svn: 336723
12 files changed:
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Utility/Args.h
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Commands/CommandObjectExpression.cpp
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Utility/Args.cpp
lldb/unittests/Utility/CMakeLists.txt
lldb/unittests/Utility/OptionsWithRawTest.cpp [new file with mode: 0644]