From 523e2cd1fe7c0242590b08ce4fcf67361f63f28c Mon Sep 17 00:00:00 2001 From: Don Hinton Date: Wed, 10 Jul 2019 17:57:05 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365675 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/clang-refactor/ClangRefactor.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/clang-refactor/ClangRefactor.cpp b/tools/clang-refactor/ClangRefactor.cpp index f7ca39fcfe..08963001cc 100644 --- a/tools/clang-refactor/ClangRefactor.cpp +++ b/tools/clang-refactor/ClangRefactor.cpp @@ -38,11 +38,9 @@ namespace opts { static cl::OptionCategory CommonRefactorOptions("Refactoring options"); static cl::opt Verbose("v", cl::desc("Use verbose output"), - cl::cat(cl::GeneralCategory), cl::sub(*cl::AllSubCommands)); static cl::opt Inplace("i", cl::desc("Inplace edit s"), - cl::cat(cl::GeneralCategory), cl::sub(*cl::AllSubCommands)); } // end namespace opts @@ -611,7 +609,7 @@ int main(int argc, const char **argv) { ClangRefactorTool RefactorTool; CommonOptionsParser Options( - argc, argv, cl::GeneralCategory, cl::ZeroOrMore, + argc, argv, *cl::GeneralCategory, cl::ZeroOrMore, "Clang-based refactoring tool for C, C++ and Objective-C"); if (auto Err = RefactorTool.Init()) { -- 2.40.0