Author: dhinton Date: Wed Jul 10 10:57:05 2019 New Revision: 365675 URL: http://llvm.org/viewvc/llvm-project?rev=365675&view=rev Log: 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 Modified: clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp Modified: clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp?rev=365675&r1=365674&r2=365675&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp (original) +++ clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp Wed Jul 10 10:57:05 2019 @@ -77,7 +77,7 @@ class Command { // By resetting the parser options, we lost the standard -help flag. llvm::cl::opt<bool, false, llvm::cl::parser<bool>> Help{ "help", llvm::cl::desc("Display available options"), - llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)}; + llvm::cl::ValueDisallowed}; virtual void run() = 0; protected: Modified: clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp?rev=365675&r1=365674&r2=365675&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp (original) +++ clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp Wed Jul 10 10:57:05 2019 @@ -110,7 +110,7 @@ int main(int argc, const char **argv) { )"; auto Executor = clang::tooling::createExecutorFromCommandLineArgs( - argc, argv, llvm::cl::GeneralCategory, Overview); + argc, argv, *llvm::cl::GeneralCategory, Overview); if (!Executor) { llvm::errs() << llvm::toString(Executor.takeError()) << "\n"; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits