mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Update the example of using a command-line option custom parser to
match the current implementation. Patch by Douglas Yung! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2273ca1302
commit
9de9951e15
@ -1630,13 +1630,13 @@ To start out, we declare our new ``FileSizeParser`` class:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
struct FileSizeParser : public cl::basic_parser<unsigned> {
|
||||
struct FileSizeParser : public cl::parser<unsigned> {
|
||||
// parse - Return true on error.
|
||||
bool parse(cl::Option &O, const char *ArgName, const std::string &ArgValue,
|
||||
bool parse(cl::Option &O, StringRef ArgName, const std::string &ArgValue,
|
||||
unsigned &Val);
|
||||
};
|
||||
|
||||
Our new class inherits from the ``cl::basic_parser`` template class to fill in
|
||||
Our new class inherits from the ``cl::parser`` template class to fill in
|
||||
the default, boiler plate code for us. We give it the data type that we parse
|
||||
into, the last argument to the ``parse`` method, so that clients of our custom
|
||||
parser know what object type to pass in to the parse method. (Here we declare
|
||||
@ -1652,7 +1652,7 @@ implement ``parse`` as:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
bool FileSizeParser::parse(cl::Option &O, const char *ArgName,
|
||||
bool FileSizeParser::parse(cl::Option &O, StringRef ArgName,
|
||||
const std::string &Arg, unsigned &Val) {
|
||||
const char *ArgStart = Arg.c_str();
|
||||
char *End;
|
||||
|
Loading…
x
Reference in New Issue
Block a user