Print registered targets in clang's version information

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

llvm-svn: 304836
This commit is contained in:
Dimitry Andric 2017-06-06 21:54:21 +00:00
parent bc3feaaa88
commit 81c40421fe
3 changed files with 7 additions and 4 deletions

View 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

View 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';
}

View 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';
}