[PATCH] D33900: Print registered targets in clang's version information
Dimitry Andric via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 5 09:54:03 PDT 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33900.101423.patch
Type: text/x-patch
Size: 1601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170605/954fa028/attachment.bin>
More information about the cfe-commits
mailing list