]> granicus.if.org Git - clang/commitdiff
Print registered targets in clang's version information
authorDimitry Andric <dimitry@andric.com>
Tue, 6 Jun 2017 21:54:21 +0000 (21:54 +0000)
committerDimitry Andric <dimitry@andric.com>
Tue, 6 Jun 2017 21:54:21 +0000 (21:54 +0000)
Summary:
Other llvm tools display their registered targets when showing version
information, but for some reason clang has never done this.

To support this, 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.

Reviewers: beanz, chandlerc, dberris, mehdi_amini, zturner

Reviewed By: mehdi_amini

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D33900

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304836 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
tools/clang-format/ClangFormat.cpp
tools/clang-offload-bundler/ClangOffloadBundler.cpp

index d07ac96a3108fc8780a6ef07b22afd6acf64df02..ec106fa93be8abfe3f4cb300725004cede390529 100644 (file)
@@ -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 @@ void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {
 
   // 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 14bff19a1a0c63e791ec00257099a13d7b8e20f4..f8e2fe186b916dc1fcef3a8a5faf5fe013d418f6 100644 (file)
@@ -328,8 +328,7 @@ static bool format(StringRef FileName) {
 }  // namespace format
 }  // namespace clang
 
-static void PrintVersion() {
-  raw_ostream &OS = outs();
+static void PrintVersion(raw_ostream &OS) {
   OS << clang::getClangToolFullVersion("clang-format") << '\n';
 }
 
index 49cdd95466894ca3ef0b32089d0b63b9816c90b9..95d3fdf14d5ead3b242df7fb3f8b0730ec582170 100644 (file)
@@ -915,8 +915,7 @@ static bool UnbundleFiles() {
   return false;
 }
 
-static void PrintVersion() {
-  raw_ostream &OS = outs();
+static void PrintVersion(raw_ostream &OS) {
   OS << clang::getClangToolFullVersion("clang-offload-bundler") << '\n';
 }