
- The motivation is to reduce the number of arguments passed around (e.g., from `show_main` to `show*Profile`). In order to do this, move function-defined options to global variables, and create `cl::SubCommand` for {show, merge, overlap, order} to organize options. - The side-effect by extracting function local options to a C++ namespace is that the extracted options are no longer (lazily) initialized when the enclosing function runs for the first time. - `cl::Subcommand` support (introduced in https://lists.llvm.org/pipermail/llvm-dev/2016-June/101804.html) could put options in a per-subcommand namespace. - One option could belong to multiple subcommand. This patch defines most of the options once and associates them with multiple subcommands except 1. `overlap` and `show` both has `value-cutoff` with different default values ([former](64f62de966/llvm/tools/llvm-profdata/llvm-profdata.cpp (L2352)
) vs [latter](64f62de966/llvm/tools/llvm-profdata/llvm-profdata.cpp (L3009)
)). Define 'OverlapValueCutoff' and 'ShowValueCutoff' respectively. 2. `show` supports three profile formats in `ProfileKind` while {`merge`, `overlap`} supports two. Define separate options. - Clean up obsolete code as a result, including `-h` and `--version` customizations. These two options are supported for all commands. Results pasted. - [-h and --help](https://gist.github.com/minglotus-6/387490e5eeda2dd2f9c440a424d6f360) output. - [--version](https://gist.github.com/minglotus-6/f905abcc3a346957bd797f2f84c18c1b) - [llvm-profdata show --help](https://gist.github.com/minglotus-6/f143079f02af243a94758138c0af471a) This PR should be `llvm-profdata` only. It depends on https://github.com/llvm/llvm-project/pull/71981
9 lines
423 B
Plaintext
9 lines
423 B
Plaintext
RUN: not llvm-profdata show 2>&1 | FileCheck %s --check-prefix SHOW-REQ
|
|
SHOW-REQ: the positional argument '<profdata-file>' is required unless '--debug-info' is provided
|
|
|
|
RUN: not llvm-profdata show file -o file 2>&1 | FileCheck %s --check-prefix SHOW-OUT
|
|
SHOW-OUT: Input file name cannot be the same as the output file name!
|
|
|
|
RUN: not llvm-profdata 2>&1 | FileCheck %s --check-prefix EMPTY
|
|
EMPTY: No subcommand specified!
|