dim created this revision. Other llvm tools display their registered targets when showing version information, but for some reason clang has never done this.
To support this, https://reviews.llvm.org/D33899 adds the llvm parts, which make it possible to print version information to arbitrary raw_ostreams. This change adds a call to printRegisteredTargetsForVersion in clang's PrintVersion, and adds a raw_ostream parameter to two other PrintVersion functions. https://reviews.llvm.org/D33900 Files: lib/Driver/Driver.cpp tools/clang-format/ClangFormat.cpp tools/clang-offload-bundler/ClangOffloadBundler.cpp Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp =================================================================== --- tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -915,8 +915,7 @@ return false; } -static void PrintVersion() { - raw_ostream &OS = outs(); +static void PrintVersion(raw_ostream &OS) { OS << clang::getClangToolFullVersion("clang-offload-bundler") << '\n'; } Index: tools/clang-format/ClangFormat.cpp =================================================================== --- tools/clang-format/ClangFormat.cpp +++ tools/clang-format/ClangFormat.cpp @@ -328,8 +328,7 @@ } // namespace format } // namespace clang -static void PrintVersion() { - raw_ostream &OS = outs(); +static void PrintVersion(raw_ostream &OS) { OS << clang::getClangToolFullVersion("clang-format") << '\n'; } Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -68,6 +68,7 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" #include "llvm/Support/Program.h" +#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/raw_ostream.h" #include <map> #include <memory> @@ -1116,6 +1117,10 @@ // Print out the install directory. OS << "InstalledDir: " << InstalledDir << '\n'; + + // Print registered targets. + OS << '\n'; + llvm::TargetRegistry::printRegisteredTargetsForVersion(OS); } /// PrintDiagnosticCategories - Implement the --print-diagnostic-categories
Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp =================================================================== --- tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -915,8 +915,7 @@ return false; } -static void PrintVersion() { - raw_ostream &OS = outs(); +static void PrintVersion(raw_ostream &OS) { OS << clang::getClangToolFullVersion("clang-offload-bundler") << '\n'; } Index: tools/clang-format/ClangFormat.cpp =================================================================== --- tools/clang-format/ClangFormat.cpp +++ tools/clang-format/ClangFormat.cpp @@ -328,8 +328,7 @@ } // namespace format } // namespace clang -static void PrintVersion() { - raw_ostream &OS = outs(); +static void PrintVersion(raw_ostream &OS) { OS << clang::getClangToolFullVersion("clang-format") << '\n'; } Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -68,6 +68,7 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" #include "llvm/Support/Program.h" +#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/raw_ostream.h" #include <map> #include <memory> @@ -1116,6 +1117,10 @@ // Print out the install directory. OS << "InstalledDir: " << InstalledDir << '\n'; + + // Print registered targets. + OS << '\n'; + llvm::TargetRegistry::printRegisteredTargetsForVersion(OS); } /// PrintDiagnosticCategories - Implement the --print-diagnostic-categories
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits