aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-16 02:06:09 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-16 02:06:09 +0000
commit603bea32743dc9914a1d32ae36fc64fe497af801 (patch)
treeca6ff5bc8e44d1c5ca644e691b2b24a33b4bca4e /lib/Support/CommandLine.cpp
parent494d663175bbaa7db4743105d1efdf78be9cdb03 (diff)
Add registered target list to --version output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75889 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/CommandLine.cpp')
-rw-r--r--lib/Support/CommandLine.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index 34200f7607..ed1ed2d5a0 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -23,6 +23,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Streams.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/System/Path.h"
#include <algorithm>
#include <functional>
@@ -823,8 +824,8 @@ size_t alias::getOptionWidth() const {
// Print out the option for the alias.
void alias::printOptionInfo(size_t GlobalWidth) const {
size_t L = std::strlen(ArgStr);
- cout << " -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - "
- << HelpStr << "\n";
+ cerr << " -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - "
+ << HelpStr << "\n";
}
@@ -1140,6 +1141,23 @@ public:
#endif
cout << ".\n";
cout << " Built " << __DATE__ << "(" << __TIME__ << ").\n";
+ cout << "\n";
+ cout << " Registered Targets:\n";
+
+ size_t Width = 0;
+ for (TargetRegistry::iterator it = TargetRegistry::begin(),
+ ie = TargetRegistry::end(); it != ie; ++it)
+ Width = std::max(Width, ::strlen(it->getName()));
+
+ 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";
+ }
+ if (!NumTargets)
+ cout << " (none)\n";
}
void operator=(bool OptionWasSpecified) {
if (OptionWasSpecified) {