Implement and document prefix options with arbitrary values including an

= sign. This needed to support -DNAME=value options as pass-through in
llvmc.

llvm-svn: 18203
This commit is contained in:
Reid Spencer 2004-11-24 06:13:42 +00:00
parent 7217642438
commit 80bb693109
2 changed files with 10 additions and 8 deletions

View File

@ -1276,13 +1276,15 @@ Arguments</a> section for more information.</li>
specifies that this option is used to capture "interpreter style" arguments. See <a href="#cl::ConsumeAfter">this section for more information</a>.</li> specifies that this option is used to capture "interpreter style" arguments. See <a href="#cl::ConsumeAfter">this section for more information</a>.</li>
<li><a name="cl::Prefix">The <b><tt>cl::Prefix</tt></b></a> modifier specifies <li><a name="cl::Prefix">The <b><tt>cl::Prefix</tt></b></a> modifier specifies
that this option prefixes its value. With 'Prefix' options, there is no equal that this option prefixes its value. With 'Prefix' options, the equal sign does
sign that separates the value from the option name specified. This is useful not separate the value from the option name specified. Instead, the value is
for processing odd arguments like '<tt>-lmalloc -L/usr/lib'</tt> in a linker everything after the prefix, including any equal sign if present. This is useful
tool. Here, the '<tt>l</tt>' and '<tt>L</tt>' options are normal string (list) for processing odd arguments like <tt>-lmalloc</tt> and <tt>-L/usr/lib</tt> in a
options, that have the <a href="#cl::Prefix">cl::Prefix</a> modifier added to linker tool or <tt>-DNAME=value</tt> in a compiler tool. Here, the
allow the CommandLine library to recognize them. Note that <a '<tt>l</tt>', '<tt>D</tt>' and '<tt>L</tt>' options are normal string (or list)
href="#cl::Prefix">cl::Prefix</a> options must not have the <a options, that have the <a href="#cl::Prefix">cl::Prefix</a> modifier added to
allow the CommandLine library to recognize them. Note that
<a href="#cl::Prefix">cl::Prefix</a> options must not have the <a
href="#cl::ValueDisallowed">cl::ValueDisallowed</a> modifier specified.</li> href="#cl::ValueDisallowed">cl::ValueDisallowed</a> modifier specified.</li>
<li><a name="cl::Grouping">The <b><tt>cl::Grouping</tt></b></a> modifier is used <li><a name="cl::Grouping">The <b><tt>cl::Grouping</tt></b></a> modifier is used

View File

@ -397,7 +397,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
Handler = LookupOption(ArgName, Value); Handler = LookupOption(ArgName, Value);
// Check to see if this "option" is really a prefixed or grouped argument. // Check to see if this "option" is really a prefixed or grouped argument.
if (Handler == 0 && *Value == 0) { if (Handler == 0) {
std::string RealName(ArgName); std::string RealName(ArgName);
if (RealName.size() > 1) { if (RealName.size() > 1) {
unsigned Length = 0; unsigned Length = 0;