summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/TargetRegistry.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dimitry@andric.com>2017-06-06 21:54:04 +0000
committerDimitry Andric <dimitry@andric.com>2017-06-06 21:54:04 +0000
commitbc3feaaa884021ee3d76b70a3a2a2617eb261148 (patch)
treee09038c6ea8a10329be5ddf4ed2da8091f1793a7 /llvm/lib/Support/TargetRegistry.cpp
parentff9d80cc7a602001b5528b57fdc5632b6f251032 (diff)
downloadbcm5719-llvm-bc3feaaa884021ee3d76b70a3a2a2617eb261148.tar.gz
bcm5719-llvm-bc3feaaa884021ee3d76b70a3a2a2617eb261148.zip
Allow VersionPrinter to print to arbitrary raw_ostreams
Summary: I would like to add printing of registered targets to clang's version information. For this to work correctly, the VersionPrinter logic in CommandLine.cpp should support printing to arbitrary raw_ostreams, instead of always defaulting to outs(). Add a raw_ostream& parameter to the function pointer type used for VersionPrinter, and while doing so, introduce a typedef for convenience. Note that VersionPrinter::print() will still default to using outs(), the clang part will necessarily go into a separate review. Reviewers: beanz, chandlerc, dberris, mehdi_amini, zturner Reviewed By: mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33899 llvm-svn: 304835
Diffstat (limited to 'llvm/lib/Support/TargetRegistry.cpp')
-rw-r--r--llvm/lib/Support/TargetRegistry.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Support/TargetRegistry.cpp b/llvm/lib/Support/TargetRegistry.cpp
index bed9ed64f80..b5c28325311 100644
--- a/llvm/lib/Support/TargetRegistry.cpp
+++ b/llvm/lib/Support/TargetRegistry.cpp
@@ -114,7 +114,7 @@ static int TargetArraySortFn(const std::pair<StringRef, const Target *> *LHS,
return LHS->first.compare(RHS->first);
}
-void TargetRegistry::printRegisteredTargetsForVersion() {
+void TargetRegistry::printRegisteredTargetsForVersion(raw_ostream &OS) {
std::vector<std::pair<StringRef, const Target*> > Targets;
size_t Width = 0;
for (const auto &T : TargetRegistry::targets()) {
@@ -123,7 +123,6 @@ void TargetRegistry::printRegisteredTargetsForVersion() {
}
array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn);
- raw_ostream &OS = outs();
OS << " Registered Targets:\n";
for (unsigned i = 0, e = Targets.size(); i != e; ++i) {
OS << " " << Targets[i].first;
OpenPOWER on IntegriCloud