[clang-tools-extra] r365675 - Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class."

2019-07-10 Thread Don Hinton via cfe-commits
Author: dhinton
Date: Wed Jul 10 10:57:05 2019
New Revision: 365675

URL: http://llvm.org/viewvc/llvm-project?rev=365675=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=365674=365675=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> 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=365674=365675=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


r365675 - Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class."

2019-07-10 Thread Don Hinton via cfe-commits
Author: dhinton
Date: Wed Jul 10 10:57:05 2019
New Revision: 365675

URL: http://llvm.org/viewvc/llvm-project?rev=365675=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:
cfe/trunk/tools/clang-refactor/ClangRefactor.cpp

Modified: cfe/trunk/tools/clang-refactor/ClangRefactor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-refactor/ClangRefactor.cpp?rev=365675=365674=365675=diff
==
--- cfe/trunk/tools/clang-refactor/ClangRefactor.cpp (original)
+++ cfe/trunk/tools/clang-refactor/ClangRefactor.cpp Wed Jul 10 10:57:05 2019
@@ -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()) {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits