History log of /llvm-project/llvm/lib/Support/CommandLine.cpp (Results 1 – 25 of 443)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3
# 136e5f48 13-Aug-2024 Rahul Joshi <rjoshi@nvidia.com>

[NFC][Support] Create helper function to parse bool (#102818)

Create a helper template function to parse bool, to eliminate code
duplication.


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# c1a5f1ea 04-Jul-2024 Kazu Hirata <kazu@google.com>

[Support] Use range-based for loops (NFC) (#97657)


# 30299b87 21-Jun-2024 Nikita Popov <npopov@redhat.com>

[CommandLine] Avoid ManagedStatic.h include (NFC)

The two variables using ManagedStatic that are exported by this
header are not actually used anywhere -- they are used through
SubCommand::getTopLev

[CommandLine] Avoid ManagedStatic.h include (NFC)

The two variables using ManagedStatic that are exported by this
header are not actually used anywhere -- they are used through
SubCommand::getTopLevel() and SubCommand::getAll() instead.
Drop the extern declarations and the include.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6
# 9b6f0735 17-May-2024 Kazu Hirata <kazu@google.com>

[Support] Drop nop conversions of StringRef to StringRef (NFC)

Both sides here are known to be of StringRef.


Revision tags: llvmorg-18.1.5, llvmorg-18.1.4
# 68b939f9 05-Apr-2024 Cassie Jones <cassie_jones@apple.com>

[driver] Make --version show if assertions, etc. are enabled (#87585)

It's useful to have some significant build options visible in the
version when investigating problems with a specific compiler

[driver] Make --version show if assertions, etc. are enabled (#87585)

It's useful to have some significant build options visible in the
version when investigating problems with a specific compiler artifact.
This makes it easy to see if assertions, expensive checks, sanitizers,
etc. are enabled when checking a compiler version.

Example config line output:
Build configuration: +unoptimized, +assertions, +asan, +ubsan

show more ...


Revision tags: llvmorg-18.1.3
# 595280af 20-Mar-2024 Jonas Devlieghere <jonas@devlieghere.com>

Revert "[llvm] Include LLVM_REPOSITORY and LLVM_REVISION in tool version" (#85879)

Reverts llvm/llvm-project#84990 because this causes a full rebuild after
the commit hash changes.


Revision tags: llvmorg-18.1.2
# 6885810e 13-Mar-2024 Jonas Devlieghere <jonas@devlieghere.com>

[llvm] Include LLVM_REPOSITORY and LLVM_REVISION in tool version (#84990)

Include the `LLVM_REPOSITORY` and `LLVM_REVISION` in the version output
of tools using `cl::PrintVersionMessage()` such as

[llvm] Include LLVM_REPOSITORY and LLVM_REVISION in tool version (#84990)

Include the `LLVM_REPOSITORY` and `LLVM_REVISION` in the version output
of tools using `cl::PrintVersionMessage()` such as dwarfdump and
dsymutil.

Before:

```
$ llvm-dwarfdump --version
LLVM (http://llvm.org/):
LLVM version 19.0.0git
Optimized build with assertions.
```

After:

```
$ llvm-dwarfdump --version
LLVM (http://llvm.org/):
LLVM version 19.0.0git (git@github.com:llvm/llvm-project.git 8467457afc61d70e881c9817ace26356ef757733)
Optimized build with assertions.
```

rdar://121526866

show more ...


Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2
# 39fa3048 01-Feb-2024 Kazu Hirata <kazu@google.com>

[llvm] Use StringRef::starts_with (NFC)


Revision tags: llvmorg-18.1.0-rc1, llvmorg-19-init
# b5d6ea4d 14-Jan-2024 Kazu Hirata <kazu@google.com>

[Support] Use StringRef::consume_front (NFC)


# 9f8c8181 12-Jan-2024 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine][NFCI] Do not add 'All' to 'RegisteredSubCommands' (#77722)

After #75679, it is no longer necessary to add the `All` pseudo
subcommand to the list of registered subcommands. The change

[CommandLine][NFCI] Do not add 'All' to 'RegisteredSubCommands' (#77722)

After #75679, it is no longer necessary to add the `All` pseudo
subcommand to the list of registered subcommands. The change causes the
list to contain only real subcommands, i.e. an unnamed top-level
subcommand and named ones. This simplifies the code a bit by removing
some checks for this special case.

This is a fixed version of #77041, where options of the 'All' subcommand
were not added to subcommands defined after them.

show more ...


# d85a13b8 11-Jan-2024 Igor Kudrin <ikudrin@accesssoftek.com>

Revert "[CommandLine][NFCI] Do not add 'All' to 'RegisteredSubCommands' (#77041)"

This reverts commit fb7fe49960ae053c92985f3376d85a15bbd10d1a.

The commit introduced a bug where an option with the

Revert "[CommandLine][NFCI] Do not add 'All' to 'RegisteredSubCommands' (#77041)"

This reverts commit fb7fe49960ae053c92985f3376d85a15bbd10d1a.

The commit introduced a bug where an option with the `All' subcommand
would not be added to a category initialized after that option.

show more ...


# fb7fe499 10-Jan-2024 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine][NFCI] Do not add 'All' to 'RegisteredSubCommands' (#77041)

After #75679, it is no longer necessary to add the `All` pseudo
subcommand to the list of registered subcommands. The change

[CommandLine][NFCI] Do not add 'All' to 'RegisteredSubCommands' (#77041)

After #75679, it is no longer necessary to add the `All` pseudo
subcommand to the list of registered subcommands. The change causes the
list to contain only real subcommands, i.e. an unnamed top-level
subcommand and named ones. This simplifies the code a bit by removing
some checks for this special case.

show more ...


# b2ea9ec7 08-Jan-2024 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine] Do not print empty categories with '--help-hidden' (#77043)

If a category has no options associated with it, the `--help-hidden`
command still shows that category with the annotation

[CommandLine] Do not print empty categories with '--help-hidden' (#77043)

If a category has no options associated with it, the `--help-hidden`
command still shows that category with the annotation "This option
category has no options", and this is how it was implemented from the
beginning when the categories were introduced, see commit 0537a98878. A
feature to hide unrelated options was added later, in
https://reviews.llvm.org/D7100. Now, if a tool needs to hide unrelated
options that are associated with categories, leaving some of them empty,
those categories will still be visible on the `--help-hidden` output,
even if they have no use for the tool; see the changes in
`llvm/test/tools/llvm-debuginfo-analyzer/cmdline.test` for an example.

The patch ensures that only categories with options are shown on both
main and hidden help output.

show more ...


# 98e20e15 19-Dec-2023 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine][NFC] Replace 'std::function' with 'function_ref' (#75973)

This implements a post-commit suggestion for #75679.


# 6a2a99fb 19-Dec-2023 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine][NFCI] Simplify enumerating subcommands of an option (#75679)

The patch adds a helper method to iterate over all subcommands to which
an option belongs. Duplicate code is removed and r

[CommandLine][NFCI] Simplify enumerating subcommands of an option (#75679)

The patch adds a helper method to iterate over all subcommands to which
an option belongs. Duplicate code is removed and replaced with calls to
this new method.

show more ...


# 4f1ddf75 14-Dec-2023 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine] Remove unused variable 'NearestHandler' (fixup for #74811)

Buildbots reported:
.../CommandLine.cpp:1626:13: error: variable 'NearestHandler' set but not used [-Werror,-Wunused-but-set-

[CommandLine] Remove unused variable 'NearestHandler' (fixup for #74811)

Buildbots reported:
.../CommandLine.cpp:1626:13: error: variable 'NearestHandler' set but not used [-Werror,-Wunused-but-set-variable]

show more ...


# de8ee03e 14-Dec-2023 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine] Better report unknown subcommands (#74811)

The patch improves the reporting for the first option in the command
line when it looks like a subcommand name but does not match any
defin

[CommandLine] Better report unknown subcommands (#74811)

The patch improves the reporting for the first option in the command
line when it looks like a subcommand name but does not match any
defined.

Before the patch:
```
> prog baz
prog: Unknown command line argument 'baz'. Try: 'prog --help'
```

With the patch:
```
> prog baz
prog: Unknown subcommand 'baz'. Try: 'prog --help'
prog: Did you mean 'bar'?
```

show more ...


# 9d66d263 08-Dec-2023 Igor Kudrin <ikudrin@accesssoftek.com>

[CommandLine] Show '[subcommand]' in the help for less than 3 subcommands (#74557)

When a tool defines only one or two subcommands, the `[subcommand]` part
is not displayed in the `USAGE` help line

[CommandLine] Show '[subcommand]' in the help for less than 3 subcommands (#74557)

When a tool defines only one or two subcommands, the `[subcommand]` part
is not displayed in the `USAGE` help line. Note that a similar issue
for printing the list of the subcommands has been fixed in
https://reviews.llvm.org/D25463.

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5
# 38b34c61 13-Nov-2023 Mingming Liu <mingmingl@google.com>

Reland "[Support]Look up in top-level subcommand as a fallback when looking options for a custom subcommand (#71981)

Fixed build bot errors.

- Use `StackOption<std::string>` type for the top lev

Reland "[Support]Look up in top-level subcommand as a fallback when looking options for a custom subcommand (#71981)

Fixed build bot errors.

- Use `StackOption<std::string>` type for the top level option. This
way, a per test-case option is unregistered when destructor of
`StackOption` cleans up state for subsequent test cases.
- Repro the crash with no test sharding `/usr/bin/python3
/path/to/llvm-project/build/./bin/llvm-lit -vv --no-gtest-sharding -j128
/path/to/llvm-project/llvm/test/Unit`. The crash is gone with the fix
(same no-sharding repro)

**Original commit message:**
**Context:**

- In https://lists.llvm.org/pipermail/llvm-dev/2016-June/101804.html and
commit
https://github.com/llvm/llvm-project/commit/07670b3e984db32f291373fe12c392959f2aff67,
`cl::SubCommand` is introduced.
- Options that don't specify subcommand goes into a special 'top level'
subcommand.

**Motivating Use Case:**
- The motivating use case is to refactor `llvm-profdata` to use
`cl::SubCommand` to organize subcommands. See
https://github.com/llvm/llvm-project/pull/71328. A valid use case that's
not supported before this patch is shown below

```
// show-option{1,2} are associated with 'show' subcommand.
// top-level-option3 is in top-level subcomand (e.g., `profile-isfs` in SampleProfReader.cpp)
llvm-profdata show --show-option1 --show-option2 --top-level-option3
```

- Before this patch, option handler look-up will fail with the following
error message "Unknown command line argument --top-level-option3".
- After this patch, option handler look-up will look up in sub-command
options first, and use top-level subcommand as a fallback, so
'top-level-option3' is parsed correctly.

show more ...


# 2e912a2b 10-Nov-2023 Mingming Liu <mingmingl@google.com>

Revert "[Support]Look up in top-level subcommand as a fallback when looking options for a custom subcommand (#71975)

…ooking options for a custom subcommand. (#71776)"

This reverts commit b88308b

Revert "[Support]Look up in top-level subcommand as a fallback when looking options for a custom subcommand (#71975)

…ooking options for a custom subcommand. (#71776)"

This reverts commit b88308b1b4813e55ce8f54ceff6e57736328fb58.

The build-bot is unhappy
(https://lab.llvm.org/buildbot/#/builders/186/builds/13096),
`GroupingAndPrefix` fails after `TopLevelOptInSubcommand` (the newly
added test).

Revert while I look into this (might be related with test sharding but
not sure)

```

[----------] 3 tests from CommandLineTest
[ RUN ] CommandLineTest.TokenizeWindowsCommandLine2
[ OK ] CommandLineTest.TokenizeWindowsCommandLine2 (0 ms)
[ RUN ] CommandLineTest.TopLevelOptInSubcommand
[ OK ] CommandLineTest.TopLevelOptInSubcommand (0 ms)
[ RUN ] CommandLineTest.GroupingAndPrefix
#0 0x00ba8118 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x594118)
#1 0x00ba5914 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x591914)
#2 0x00ba89c4 SignalHandler(int) (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5949c4)
#3 0xf7828530 __default_sa_restorer /build/glibc-9MGTF6/glibc-2.31/signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:67:0
#4 0x00af91f0 (anonymous namespace)::CommandLineParser::ResetAllOptionOccurrences() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x4e51f0)
#5 0x00af8e1c llvm::cl::ResetCommandLineParser() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x4e4e1c)
#6 0x0077cda0 (anonymous namespace)::CommandLineTest_GroupingAndPrefix_Test::TestBody() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x168da0)
#7 0x00bc5adc testing::Test::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5b1adc)
#8 0x00bc6cc0 testing::TestInfo::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5b2cc0)
#9 0x00bc7880 testing::TestSuite::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5b3880)
#10 0x00bd7974 testing::internal::UnitTestImpl::RunAllTests() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5c3974)
#11 0x00bd6ebc testing::UnitTest::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5c2ebc)
#12 0x00bb1058 main (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x59d058)
#13 0xf78185a4 __libc_start_main /build/glibc-9MGTF6/glibc-2.31/csu/libc-start.c:342:3
```

show more ...


# b88308b1 10-Nov-2023 Mingming Liu <mingmingl@google.com>

[Support]Look up in top-level subcommand as a fallback when looking options for a custom subcommand. (#71776)

**Context:**

- In https://lists.llvm.org/pipermail/llvm-dev/2016-June/101804.html and

[Support]Look up in top-level subcommand as a fallback when looking options for a custom subcommand. (#71776)

**Context:**

- In https://lists.llvm.org/pipermail/llvm-dev/2016-June/101804.html and commit 07670b3e984db32f291373fe12c392959f2aff67, `cl::SubCommand` is introduced.
- Options that don't specify subcommand goes into a special 'top level' subcommand.

**Motivating Use Case:**
- The motivating use case is to refactor `llvm-profdata` to use `cl::SubCommand` to organize subcommands. See
https://github.com/llvm/llvm-project/pull/71328. A valid use case that's not supported before this patch is shown below

```
// show-option{1,2} are associated with 'show' subcommand.
// top-level-option3 is in top-level subcomand (e.g., `profile-isfs` in SampleProfReader.cpp)
llvm-profdata show --show-option1 --show-option2 --top-level-option3
```

- Before this patch, option handler look-up will fail with the following error message "Unknown command line argument --top-level-option3".
- After this patch, option handler look-up will look up in sub-command options first, and use top-level subcommand as a fallback, so 'top-level-option3' is parsed correctly.

show more ...


Revision tags: llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0
# 710b5a12 10-Sep-2023 Christian Sigg <chsigg@users.noreply.github.com>

Fix logic to detect cl::option equality. (#65754)

This is a new attempt of https://reviews.llvm.org/D159481, this time as
GitHub PR.

`GenericOptionValue::compare()` should return `true` for a ma

Fix logic to detect cl::option equality. (#65754)

This is a new attempt of https://reviews.llvm.org/D159481, this time as
GitHub PR.

`GenericOptionValue::compare()` should return `true` for a match.

- `OptionValueBase::compare()` always returns `false` and shouldn't
match anything.
- `OptionValueCopy::compare()` returns `false` if not `Valid` which
corresponds to no match.

Also adding some tests.

show more ...


Revision tags: llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0
# 8bdf3878 15-Mar-2023 Kazu Hirata <kazu@google.com>

Use *{Map,Set}::contains (NFC)

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


# b595eb83 15-Mar-2023 Kazu Hirata <kazu@google.com>

[llvm] Use *{Set,Map}::contains (NFC)


Revision tags: llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7
# 142aa1bd 13-Dec-2022 Archibald Elliott <archibald.elliott@arm.com>

[Support] Move Target/CPU Printing out of CommandLine

This change is rather more invasive than intended. The main intention
here is to make CommandLine.cpp not rely on llvm/Support/Host.h. Right
now

[Support] Move Target/CPU Printing out of CommandLine

This change is rather more invasive than intended. The main intention
here is to make CommandLine.cpp not rely on llvm/Support/Host.h. Right
now, this reliance is only in 3 superficial places:
- Choosing how to expand response files (in two places)
- Printing the default triple and current CPU in `--version` output.

The built in version system has a method for adding "extra version
printers", commonly used by several tools (such as llc) to report the
registered targets in the built version of LLVM. It was reasonably easy
to move the logic for printing the default triple and current CPU into
a similar function, and register it with any relevant binaries.

The incompatible change here is that now, even if
LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO is defined, most binaries
will no longer print out the default target triple and cpu when provided
with `--version`, for instance llvm-as and llvm-dis. This breakage is
intended, but the changes in this patch keep printing the default target
and detected in `llc` and `opt` as these were remarked as important
binaries in the LLVM install.

The change to expanding response files may also be controversial, but I
believe that these macros should correspond exactly to the host triple
introspection used before.

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

show more ...


12345678910>>...18