CommandLine: add and use cl::SubCommand::get{All,TopLevel}
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 29 Jun 2022 10:32:45 +0000 (12:32 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 2 Aug 2022 21:49:16 +0000 (23:49 +0200)
commitf7872cdce1102a5c12633dad462a1d9763a578d3
tree2866aa0bdcc13049c2fd7fda2bb50ae8d616f646
parente8468ddebc6d2fff1a008777300cfd3df0f87524
CommandLine: add and use cl::SubCommand::get{All,TopLevel}

Prefer using these accessors to access the special sub-commands
corresponding to the top-level (no subcommand) and all sub-commands.

This is a preparatory step towards removing the use of ManagedStatic:
with a subsequent change, these global instances will be moved to
be regular function-scope statics.

It is split up to give downstream projects a (albeit short) window in
which they can switch to using the accessors in a forward-compatible
way.

Differential Revision: https://reviews.llvm.org/D129118
bolt/lib/Utils/CommandLineOpts.cpp
bolt/tools/driver/llvm-bolt.cpp
clang/lib/Tooling/CommonOptionsParser.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/include/llvm/Support/CommandLine.h
llvm/lib/Support/CommandLine.cpp
llvm/tools/llvm-xray/llvm-xray.cpp
llvm/unittests/Support/CommandLineInit/CommandLineInitTest.cpp
llvm/unittests/Support/CommandLineTest.cpp