aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-26 05:09:50 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-26 05:09:50 +0000
commit8032993d2b6021cfe84b800d439a6521ce63bdee (patch)
treecfbfb77a1068257bea4ad65c11641868d9313a2a
parent68c9ce7c9e803dcb79ff465770e6dafa65f12779 (diff)
downloadexternal_llvm-8032993d2b6021cfe84b800d439a6521ce63bdee.zip
external_llvm-8032993d2b6021cfe84b800d439a6521ce63bdee.tar.gz
external_llvm-8032993d2b6021cfe84b800d439a6521ce63bdee.tar.bz2
Sort list of targets in --version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77127 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/CommandLine.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index ed1ed2d..b757b21 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -1144,19 +1144,22 @@ public:
cout << "\n";
cout << " Registered Targets:\n";
+ std::vector<std::pair<std::string, const Target*> > Targets;
size_t Width = 0;
for (TargetRegistry::iterator it = TargetRegistry::begin(),
- ie = TargetRegistry::end(); it != ie; ++it)
+ ie = TargetRegistry::end(); it != ie; ++it) {
+ Targets.push_back(std::make_pair(it->getName(), &*it));
Width = std::max(Width, ::strlen(it->getName()));
+ }
+ std::sort(Targets.begin(), Targets.end());
- unsigned NumTargets = 0;
- for (TargetRegistry::iterator it = TargetRegistry::begin(),
- ie = TargetRegistry::end(); it != ie; ++it, ++NumTargets) {
- cout << " " << it->getName()
- << std::string(Width - ::strlen(it->getName()), ' ') << " - "
- << it->getShortDescription() << "\n";
+ for (unsigned i = 0, e = Targets.size(); i != e; ++i) {
+ const Target *T = Targets[i].second;
+ cout << " " << T->getName()
+ << std::string(Width - ::strlen(T->getName()), ' ') << " - "
+ << T->getShortDescription() << "\n";
}
- if (!NumTargets)
+ if (Targets.empty())
cout << " (none)\n";
}
void operator=(bool OptionWasSpecified) {