This is an archive of the discontinued LLVM Phabricator instance.

Add support for prefix-only CLI options
ClosedPublic

Authored by thopre on Jan 10 2019, 7:46 AM.

Details

Summary

Add support for options that always prefix their value, giving an error
if the value is in the next argument or if the option is given a value
assignment (ie. opt=val). This is the desired behavior for the -D option
of FileCheck for instance.

Copyright:

  • Linaro (changes in version 2 of revision D55940)
  • GraphCore (changes in later versions and introduced when creating D56549)

Diff Detail

Event Timeline

thopre created this revision.Jan 10 2019, 7:46 AM
thopre updated this revision to Diff 181068.Jan 10 2019, 8:19 AM

Fix comment in LookupOption for AlwaysPrefix early bail out

thopre updated this revision to Diff 181069.Jan 10 2019, 8:24 AM

Clarify what happens in LookupOption when failing to match an option.

I commented when this was part of D55940. However, I'm not as familiar with this area, especially the unit testing, so someone else should review further.

probinson accepted this revision.Jan 10 2019, 11:13 AM

Nice work on the prefix tests. One comment nit and LGTM.

llvm/lib/Support/CommandLine.cpp
547

... or the option only supports ...

This revision is now accepted and ready to land.Jan 10 2019, 11:13 AM
thopre edited the summary of this revision. (Show Details)Jan 12 2019, 4:44 AM
This revision was automatically updated to reflect the committed changes.