diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-26 05:09:50 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-26 05:09:50 +0000 |
commit | a0ad190a357efd9e11e20c9f7dbff835c41cc3d9 (patch) | |
tree | d980c9c822a726b085d05396dc9b601fe4641430 /llvm/lib/Support/CommandLine.cpp | |
parent | ee01b242e8600e97dea3f0c0bd9895c8dc71bf94 (diff) | |
download | bcm5719-llvm-a0ad190a357efd9e11e20c9f7dbff835c41cc3d9.tar.gz bcm5719-llvm-a0ad190a357efd9e11e20c9f7dbff835c41cc3d9.zip |
Sort list of targets in --version.
llvm-svn: 77127
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index ed1ed2d5a09..b757b21c1a2 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/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) { |