From 4039313b4c9796d194d90f88675ceb47a183696e Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 22 Jul 2011 07:50:48 +0000 Subject: Move the registered target printing in version strings completely out of the Support library. Now its part of the TargetRegistry, and the three commands that care about this explicitly register this extra bit of version information. The set of commands which care was computed by intersecting those which use the Support library's version string printing and those that initialize all the registered targets in a way that produces a meaningful list. The only odd ball out is that 'clang -cc1as -version' no longer prints the registered targets. I don't think anyone is really interested in that (especially as the fact that llvm-mc does so is under a FIXME), but if someone really does want this back I'll happily apply the same patch there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135757 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llc/llc.cpp | 3 +++ tools/llvm-mc/llvm-mc.cpp | 4 ++++ tools/llvm-objdump/llvm-objdump.cpp | 4 ++++ 3 files changed, 11 insertions(+) (limited to 'tools') diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index f2c4c27f7d..9fe113f186 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -238,6 +238,9 @@ int main(int argc, char **argv) { InitializeAllAsmPrinters(); InitializeAllAsmParsers(); + // Register the target printer for --version. + cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion); + cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); // Load the module to be compiled... diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index f365972561..5d4f015547 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -463,6 +463,10 @@ int main(int argc, char **argv) { llvm::InitializeAllAsmParsers(); llvm::InitializeAllDisassemblers(); + // Register the target printer for --version. + // FIXME: Remove when we stop initializing the Target(Machine)s above. + cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion); + cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n"); TripleName = Triple::normalize(TripleName); diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 21df7ccd9d..2efdc0de03 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -313,6 +313,10 @@ int main(int argc, char **argv) { llvm::InitializeAllAsmParsers(); llvm::InitializeAllDisassemblers(); + // Register the target printer for --version. + // FIXME: Remove when we stop initializing the Target(Machine)s above. + cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion); + cl::ParseCommandLineOptions(argc, argv, "llvm object file dumper\n"); TripleName = Triple::normalize(TripleName); -- cgit v1.2.3