diff options
author | Don Hinton <hintonda@gmail.com> | 2019-07-10 17:57:05 +0000 |
---|---|---|
committer | Don Hinton <hintonda@gmail.com> | 2019-07-10 17:57:05 +0000 |
commit | 523e2cd1fe7c0242590b08ce4fcf67361f63f28c (patch) | |
tree | e35633713dca02754584ae851f2303ab2afb5031 /tools | |
parent | bb2b9f6e0a049e3601aa60b070352c50f6859a26 (diff) | |
download | clang-523e2cd1fe7c0242590b08ce4fcf67361f63f28c.tar.gz |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/clang-refactor/ClangRefactor.cpp | 4 |
1 files changed, 1 insertions, 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<bool> Verbose("v", cl::desc("Use verbose output"), - cl::cat(cl::GeneralCategory), cl::sub(*cl::AllSubCommands)); static cl::opt<bool> Inplace("i", cl::desc("Inplace edit <file>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()) { |