aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-20 05:48:01 +0000
committerChris Lattner <sabre@nondot.org>2009-09-20 05:48:01 +0000
commita81653676cd5fc5e695af54399394225e8d89b79 (patch)
tree054acf41e4ce7258c2fc6902a7a4b2bb68172740 /lib/Support
parentbd2115c7b222e57eda27fa44dc982fee783c338d (diff)
downloadexternal_llvm-a81653676cd5fc5e695af54399394225e8d89b79.zip
external_llvm-a81653676cd5fc5e695af54399394225e8d89b79.tar.gz
external_llvm-a81653676cd5fc5e695af54399394225e8d89b79.tar.bz2
switch an std::string to StringRef, shaving 400 bytes off CommandLine.o
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82370 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/CommandLine.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index 5abc3c4..c1569ed 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -1145,33 +1145,32 @@ public:
<< "\n"
<< " Registered Targets:\n";
- std::vector<std::pair<std::string, const Target*> > Targets;
+ std::vector<std::pair<StringRef, const Target*> > Targets;
size_t Width = 0;
for (TargetRegistry::iterator it = TargetRegistry::begin(),
ie = TargetRegistry::end(); it != ie; ++it) {
Targets.push_back(std::make_pair(it->getName(), &*it));
- Width = std::max(Width, Targets.back().first.length());
+ Width = std::max(Width, Targets.back().first.size());
}
array_pod_sort(Targets.begin(), Targets.end());
for (unsigned i = 0, e = Targets.size(); i != e; ++i) {
outs() << " " << Targets[i].first;
- outs().indent(Width - Targets[i].first.length()) << " - "
+ outs().indent(Width - Targets[i].first.size()) << " - "
<< Targets[i].second->getShortDescription() << '\n';
}
if (Targets.empty())
outs() << " (none)\n";
}
void operator=(bool OptionWasSpecified) {
- if (OptionWasSpecified) {
- if (OverrideVersionPrinter == 0) {
- print();
- exit(1);
- } else {
- (*OverrideVersionPrinter)();
- exit(1);
- }
+ if (!OptionWasSpecified) return;
+
+ if (OverrideVersionPrinter == 0) {
+ print();
+ exit(1);
}
+ (*OverrideVersionPrinter)();
+ exit(1);
}
};
} // End anonymous namespace