summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-20 05:18:28 +0000
committerChris Lattner <sabre@nondot.org>2009-09-20 05:18:28 +0000
commit64dbb5ca5a18113837cf391a3753610f34b36155 (patch)
tree117845105d7d5e3d4fd8d5225945a446e9bcbc26 /llvm/lib/Support/CommandLine.cpp
parent28610b98784ab62f10e9452a6aebf91e8164b0cb (diff)
downloadbcm5719-llvm-64dbb5ca5a18113837cf391a3753610f34b36155.tar.gz
bcm5719-llvm-64dbb5ca5a18113837cf391a3753610f34b36155.zip
Eliminate a masochistic "algorithm" loop, shrinking CommandLine.o from 71524->70700 bytes.
llvm-svn: 82366
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index e2da198ea7b..228d60a62e0 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -1017,14 +1017,6 @@ class HelpPrinter {
const Option *EmptyArg;
const bool ShowHidden;
- // isHidden/isReallyHidden - Predicates to be used to filter down arg lists.
- inline static bool isHidden(Option *Opt) {
- return Opt->getOptionHiddenFlag() >= Hidden;
- }
- inline static bool isReallyHidden(Option *Opt) {
- return Opt->getOptionHiddenFlag() == ReallyHidden;
- }
-
public:
explicit HelpPrinter(bool showHidden) : ShowHidden(showHidden) {
EmptyArg = 0;
@@ -1043,14 +1035,17 @@ public:
std::vector<Option*> Opts;
for (StringMap<Option*>::iterator I = OptMap.begin(), E = OptMap.end();
I != E; ++I) {
+ // Ignore really-hidden options.
+ if (I->second->getOptionHiddenFlag() == ReallyHidden)
+ continue;
+
+ // Unless showhidden is set, ignore hidden flags.
+ if (I->second->getOptionHiddenFlag() == Hidden && !ShowHidden)
+ continue;
+
Opts.push_back(I->second);
}
- // Eliminate Hidden or ReallyHidden arguments, depending on ShowHidden
- Opts.erase(std::remove_if(Opts.begin(), Opts.end(),
- std::ptr_fun(ShowHidden ? isReallyHidden : isHidden)),
- Opts.end());
-
// Eliminate duplicate entries in table (from enum flags options, f.e.).
{ // Give OptionSet a scope
SmallPtrSet<Option*, 32> OptionSet;
OpenPOWER on IntegriCloud