Skip to content

Commit

Permalink
Print registered targets in clang's version information
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DimitryAndric committed Jun 6, 2017
1 parent bc3feaa commit 81c4042
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions clang/lib/Driver/Driver.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions clang/tools/clang-format/ClangFormat.cpp
Expand Up @@ -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';
}

Expand Down
3 changes: 1 addition & 2 deletions clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
Expand Up @@ -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';
}

Expand Down

0 comments on commit 81c4042

Please sign in to comment.