History log of /llvm-project/llvm/lib/Option/OptTable.cpp (Results 51 – 75 of 118)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 3e2bd82f 31-Aug-2021 Kevin Athey <kda@google.com>

Revert "[OptTable] Improve error message output for grouped short options"

This reverts commit 71d7fed3bc2ad6c22729d446526a59fcfd99bd03.

Reason: broke sanitizer bots
more info: https://reviews.llvm

Revert "[OptTable] Improve error message output for grouped short options"

This reverts commit 71d7fed3bc2ad6c22729d446526a59fcfd99bd03.

Reason: broke sanitizer bots
more info: https://reviews.llvm.org/D108770

show more ...


# 71d7fed3 31-Aug-2021 gbreynoo <Owen.Reynolds@sony.com>

[OptTable] Improve error message output for grouped short options

As seen in https://bugs.llvm.org/show_bug.cgi?id=48880 the current
implementation for parsing grouped short options can return uncle

[OptTable] Improve error message output for grouped short options

As seen in https://bugs.llvm.org/show_bug.cgi?id=48880 the current
implementation for parsing grouped short options can return unclear
error messages. This change fixes the example given in the ticket in
which a flag is incorrectly given an argument. Also when parsing a
group we now keep reading past the first incorrect option and output
errors for all incorrect options in the group.

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

show more ...


Revision tags: llvmorg-13.0.0-rc2
# dcc6b7b1 05-Aug-2021 Andrzej Warzynski <andrzej.warzynski@arm.com>

[OptTable] Refine how `printHelp` treats empty help texts

Currently, `printHelp` behaves differently for options that:
* do not define `HelpText` (such options _are not printed_), and
* define i

[OptTable] Refine how `printHelp` treats empty help texts

Currently, `printHelp` behaves differently for options that:
* do not define `HelpText` (such options _are not printed_), and
* define its `HelpText` as `HelpText<"">` (such options _are printed_).
In practice, both approaches lead to no help text and `printHelp` should
treat them consistently. This patch addresses that by making
`printHelpt` check the length of the help text to be printed.

All affected tests have been updated accordingly. The option definitions
for llvm-cvtres have been updated with a short description or "Not
implemented" for options that are ignored by the tool.

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

show more ...


Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3
# f1e2d585 24-Jun-2021 Fangrui Song <i@maskray.me>

[OptTable] Rename PrintHelp to printHelp

To be consistent with other member functions and match the coding standard.


# 42f74e82 23-Jun-2021 Martin Storsjö <martin@martin.st>

[llvm] Rename StringRef _lower() method calls to _insensitive()

This is a mechanical change. This actually also renames the
similarly named methods in the SmallString class, however these
methods do

[llvm] Rename StringRef _lower() method calls to _insensitive()

This is a mechanical change. This actually also renames the
similarly named methods in the SmallString class, however these
methods don't seem to be used outside of the llvm subproject, so
this doesn't break building of the rest of the monorepo.

show more ...


Revision tags: llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1
# e5b4dbab 12-Jan-2021 Kazu Hirata <kazu@google.com>

[llvm] Simplify string comparisons (NFC)

Identified with readability-string-compare.


Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2
# c4e327a9 05-Dec-2020 Aditya Kumar <1894981+hiraditya@users.noreply.github.com>

Remove memory allocation with string

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


Revision tags: llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3
# 4eed800b 11-Sep-2020 Andrzej Warzynski <andrzej.warzynski@arm.com>

[NFC] Fix the signature and definition of findByPrefix

In https://reviews.llvm.org/rG257b29715bb27b7d9f6c3c40c481b6a4af0b37e5,
the definition of OptTable::Info::Flags was changed from `unsigned
shor

[NFC] Fix the signature and definition of findByPrefix

In https://reviews.llvm.org/rG257b29715bb27b7d9f6c3c40c481b6a4af0b37e5,
the definition of OptTable::Info::Flags was changed from `unsigned
short` to `unsigned int`, but the definition/declaration of
OptTable::findByPrefix wasn't updated to reflect that.

This patch updates findByPrefix accordingly.

show more ...


Revision tags: llvmorg-11.0.0-rc2
# d54c252b 13-Aug-2020 Nadav Rotem <nadav256@gmail.com>

[Clang options] Optimize optionMatches() runtime by removing mallocs

The method optionMatches() constructs 9865 std::string instances when comparing different
options. Many of these instances exceed

[Clang options] Optimize optionMatches() runtime by removing mallocs

The method optionMatches() constructs 9865 std::string instances when comparing different
options. Many of these instances exceed the size of the internal storage and force memory
allocations. This patch adds an early exit check that eliminates most of the string allocations
while keeping the code simple.

Example inputs:
Prefix: /, Name: Fr
Prefix: -, Name: Fr
Prefix: -, Name: fsanitize-address-field-padding=
Prefix: -, Name: fsanitize-address-globals-dead-stripping
Prefix: -, Name: fsanitize-address-poison-custom-array-cookie
Prefix: -, Name: fsanitize-address-use-after-scope
Prefix: -, Name: fsanitize-address-use-odr-indicator
Prefix: -, Name: fsanitize-blacklist=

Differential Revision: D85538

show more ...


# 593e1962 04-Aug-2020 Fangrui Song <maskray@google.com>

[llvm-symbolizer] Switch command line parsing from llvm::cl to OptTable

for the advantage outlined by D83639 ([OptTable] Support grouped short options)

Some behavior changes:

* -i={0,false} is rem

[llvm-symbolizer] Switch command line parsing from llvm::cl to OptTable

for the advantage outlined by D83639 ([OptTable] Support grouped short options)

Some behavior changes:

* -i={0,false} is removed. Use --no-inlines instead.
* --demangle={0,false} is removed. Use --no-demangle instead
* -untag-addresses={0,false} is removed. Use --no-untag-addresses instead

Added a higher level API OptTable::parseArgs which handles optional
initial options populated from an environment variable, expands response
files recursively, and parses options.

Reviewed By: jhenderson

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

show more ...


Revision tags: llvmorg-11.0.0-rc1
# f8a29b17 17-Jul-2020 Fangrui Song <maskray@google.com>

[OptTable] Support grouped short options

POSIX.1-2017 12.2 Utility Syntax Guidelines, Guideline 5 says:

> One or more options without option-arguments, followed by at most one option that takes an

[OptTable] Support grouped short options

POSIX.1-2017 12.2 Utility Syntax Guidelines, Guideline 5 says:

> One or more options without option-arguments, followed by at most one option that takes an option-argument, should be accepted when grouped behind one '-' delimiter.

i.e. -abc represents -a -b -c. The grouped short options are very common. Many
utilities extend the syntax by allowing (an option with an argument) following a
sequence of short options.

This patch adds the support to OptTable, similar to cl::Group for CommandLine
(D58711). llvm-symbolizer will use the feature (D83530). CommandLine is exotic
in some aspects. OptTable is preferred if the user wants to get rid of the
behaviors.

* `cl::opt<bool> i(...)` can be disabled via -i=false or -i=0, which is
different from conventional --no-i.
* Handling --foo & --no-foo requires a comparison of argument positions,
which is a bit clumsy in user code.

OptTable::parseOneArg (non-const reference InputArgList) is added along with
ParseOneArg (const ArgList &). The duplicate does not look great at first
glance. However, The implementation can be simpler if ArgList is mutable.
(ParseOneArg is used by clang-cl (FlagsToInclude/FlagsToExclude) and lld COFF
(case-insensitive). Adding grouped short options can make the function even more
complex.)

The implementation allows a long option following a group of short options. We
probably should refine the code to disallow this in the future. Allowing this
seems benign for now.

Reviewed By: grimar, jhenderson

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

show more ...


Revision tags: llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1
# adcd0268 28-Jan-2020 Benjamin Kramer <benny.kra@googlemail.com>

Make llvm::StringRef to std::string conversions explicit.

This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly m

Make llvm::StringRef to std::string conversions explicit.

This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.

This doesn't actually modify StringRef yet, I'll do that in a follow-up.

show more ...


Revision tags: llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1
# c991daa5 01-May-2019 Nico Weber <nicolasweber@gmx.de>

Option spell checking: Penalize delimiter flags if input has no argument

If the user passes a flag like `-version` to a program, it's more likely
they mean `--version` than `-version:`, since there'

Option spell checking: Penalize delimiter flags if input has no argument

If the user passes a flag like `-version` to a program, it's more likely
they mean `--version` than `-version:`, since there's no parameter
passed. Hence, give delimited arguments a penalty of 1 if the user input
doesn't contain the delimiter or no data after it.

The motivation is that with this, lld-link can suggest "--version"
instead of "-version:" for "-version" and "-nodefaultlib" instead of
"-nodefaultlib:" for "-nodefaultlibs".

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

llvm-svn: 359701

show more ...


# f68e0f79 01-May-2019 Nico Weber <nicolasweber@gmx.de>

Fix OptTable::findNearest() adding delimiter for free

Prior to this, OptTable::findNearest() thought that the input `--foo`
had an editing distance of 0 from an existing flag `--foo=`, which made
it

Fix OptTable::findNearest() adding delimiter for free

Prior to this, OptTable::findNearest() thought that the input `--foo`
had an editing distance of 0 from an existing flag `--foo=`, which made
it suggest flags with delimiters more often than flags without one.
After this, it correctly assigns this case an editing distance of 1.

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

llvm-svn: 359685

show more ...


# 4e701ab1 01-May-2019 Nico Weber <nicolasweber@gmx.de>

Wrap to 80 columns, no behavior change

llvm-svn: 359679


# e7fa09e4 30-Apr-2019 Nico Weber <nicolasweber@gmx.de>

Fix stack-use-after free after r359580

`Candidate` was a StringRef refering to a temporary string.
Instead, create a local variable for the string and use
a StringRef referring to that.

llvm-svn: 3

Fix stack-use-after free after r359580

`Candidate` was a StringRef refering to a temporary string.
Instead, create a local variable for the string and use
a StringRef referring to that.

llvm-svn: 359604

show more ...


# 98ca8da5 30-Apr-2019 Nico Weber <nicolasweber@gmx.de>

Re-reland "[Option] Fix PR37006 prefix choice in findNearest"

This was first reviewed in https://reviews.llvm.org/D46776 and
landed in r332299, but got reverted because it broke the PS4
bots.

https

Re-reland "[Option] Fix PR37006 prefix choice in findNearest"

This was first reviewed in https://reviews.llvm.org/D46776 and
landed in r332299, but got reverted because it broke the PS4
bots.

https://reviews.llvm.org/D50410 fixed this, and then this
change was re-reviewed at https://reviews.llvm.org/D50515 and
relanded in r341329. It got reverted due to causing MSan issues.
However, nobody wrote down the error message and the bot link
is dead, so I'm relanding this to capture the MSan error.
I'll then either fix it, or copy it somewhere and revert if
fixing looks difficult.

llvm-svn: 359580

show more ...


Revision tags: llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1
# 2946cd70 19-Jan-2019 Chandler Carruth <chandlerc@gmail.com>

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the ne

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636

show more ...


Revision tags: llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1
# 88478bbc 10-Oct-2018 Fangrui Song <maskray@google.com>

[opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>"

Summary:
Before, "[options] <inputs>" is unconditionally appended to the `Name` parameter.

[opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>"

Summary:
Before, "[options] <inputs>" is unconditionally appended to the `Name` parameter. It is more flexible to change its semantic to `Usage` and let user customize the usage line.

% llvm-objcopy
...
USAGE: llvm-objcopy <input> [ <output> ] [options] <inputs>

With this patch:

% llvm-objcopy
...
USAGE: llvm-objcopy input [output]

Reviewers: rupprecht, alexshap, jhenderson

Reviewed By: rupprecht

Subscribers: jakehehrlich, mehdi_amini, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 344097

show more ...


Revision tags: llvmorg-7.0.0, llvmorg-7.0.0-rc3
# dfe99574 03-Sep-2018 Brian Gesiak <modocache@gmail.com>

Revert r341329 due to MSAN error

Pushing https://reviews.llvm.org/rL341329 revealed an MSAN error. Revert it
so that we can fix the error.

llvm-svn: 341333


# f5344853 03-Sep-2018 Brian Gesiak <modocache@gmail.com>

Re-push "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
Original changeset (https://reviews.llvm.org/D46776) by @modocache. It was
reverted after the PS4 bot failed.

The issue has been

Re-push "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
Original changeset (https://reviews.llvm.org/D46776) by @modocache. It was
reverted after the PS4 bot failed.

The issue has been determined to be with the way the PS4 SDK handles this
particular option. https://reviews.llvm.org/D50410 removes this test, so we
can push this again.

Patch by Arnaud Coomans!

Reviewers: cfe-commits, modocache

Reviewed By: modocache

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

llvm-svn: 341329

show more ...


Revision tags: llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2
# 9968e0dd 19-May-2018 Brian Gesiak <modocache@gmail.com>

Re-revert "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
Reverting due to a test failure in an llvm-mt test on some buildbots, namely
http://green.lab.llvm.org/green/job/clang-stage2-c

Re-revert "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
Reverting due to a test failure in an llvm-mt test on some buildbots, namely
http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/26020/.

llvm-svn: 332812

show more ...


# 8cfb4b6d 19-May-2018 Brian Gesiak <modocache@gmail.com>

Un-revert "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
In https://reviews.llvm.org/rL332804 I loosed the assertion in
the Clang driver test that forced me to revert
https://reviews.l

Un-revert "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
In https://reviews.llvm.org/rL332804 I loosed the assertion in
the Clang driver test that forced me to revert
https://reviews.llvm.org/rL332299. Once this lands I should be
able to narrow down what caused PS4 buildbots to fail, and
reinstate the check in that test.

Test Plan: check-llvm & check-clang

llvm-svn: 332805

show more ...


# ed5b3255 14-May-2018 Brian Gesiak <modocache@gmail.com>

Revert "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
This revision causes build failures in PS4 and ppc64le buildbots (for example,
http://lab.llvm.org:8011/builders/llvm-clang-lld-x8

Revert "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
This revision causes build failures in PS4 and ppc64le buildbots (for example,
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/29988).
I'll revert for now and try to diagnose the issue.

Test Plan: check-llvm check-clang

llvm-svn: 332304

show more ...


# eda977f4 14-May-2018 Brian Gesiak <modocache@gmail.com>

[Option] Fix PR37006 prefix choice in findNearest

Summary:
In https://bugs.llvm.org/show_bug.cgi?id=37006 Nico Weber points out a
flaw in `OptTable::findNearest`: if an option "foo"'s prefixes are "

[Option] Fix PR37006 prefix choice in findNearest

Summary:
In https://bugs.llvm.org/show_bug.cgi?id=37006 Nico Weber points out a
flaw in `OptTable::findNearest`: if an option "foo"'s prefixes are "--"
and "-", then the nearest option for "--fob" will be "-foo". This is
incorrect, however, since the function is expected to return "--foo".

The bug is due to a naive loop that attempts to predetermines which
prefix is best. Instead, compute the edit distance for each prefix/name
pair.

Test Plan: `check-llvm`

Reviewers: thakis

Reviewed By: thakis

Subscribers: llvm-commits

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

llvm-svn: 332299

show more ...


12345