Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option...
authorDon Hinton <hintonda@gmail.com>
Wed, 10 Jul 2019 17:57:05 +0000 (17:57 +0000)
committerDon Hinton <hintonda@gmail.com>
Wed, 10 Jul 2019 17:57:05 +0000 (17:57 +0000)
commit43d75f977853c3ec891a440c362b2df183a211b5
tree8efff444c18d00719e671d5a6bb99719787fce42
parent5dd2af5248789933a865c4e2b3cb058c519912d9
Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class."

Previously reverted in 364141 due to buildbot breakage, and fixed here
by making GeneralCategory global a ManagedStatic.

Summary:
This change processes `OptionCategory`s and `SubCommand`s as they
are seen instead of caching them in the Option class and processing
them later.  Doing so simplifies the work needed to be done by the Global
parser and significantly reduces the size of the Option class to a mere 64
bytes.

Removing  the `OptionCategory` cache saved 24 bytes, and removing
the `SubCommand` cache saved an additional 48 bytes, for a total of a
72 byte reduction.

Reviewed By: serge-sans-paille

Tags: #llvm, #clang

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

llvm-svn: 365675
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/indexer/IndexerMain.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/include/llvm/Support/CommandLine.h
llvm/lib/Support/CommandLine.cpp
llvm/unittests/Support/CommandLineTest.cpp