Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the…


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.

This change processes OptionCategorys and SubCommands 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

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

Event Timeline

@hintonda, this patch caused a crash in SupportTests (CommandLineTest.AliasesWithArguments), I have reverted in rL365742. Feel free to re-commit it after you fix the issue.