r304899 - Only print registered targets for `--version`

Dimitry Andric via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 05:05:42 PDT 2017


Author: dim
Date: Wed Jun  7 07:05:41 2017
New Revision: 304899

URL: http://llvm.org/viewvc/llvm-project?rev=304899&view=rev
Log:
Only print registered targets for `--version`

Summary:
In D33900, I added printing of the registered targets in clang's
`PrintVersion` function, which is not only used for `--version` output,
but also for `-v` (verbose mode) and `-###`.  Especially the latter
seems to trip up some test cases, so it is probably better to only print
the registered targets for `--version`.

Reviewers: nemanjai, mehdi_amini

Reviewed By: nemanjai

Subscribers: cfe-commits

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

Modified:
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=304899&r1=304898&r2=304899&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Jun  7 07:05:41 2017
@@ -1117,10 +1117,6 @@ void Driver::PrintVersion(const Compilat
 
   // Print out the install directory.
   OS << "InstalledDir: " << InstalledDir << '\n';
-
-  // Print registered targets.
-  OS << '\n';
-  llvm::TargetRegistry::printRegisteredTargetsForVersion(OS);
 }
 
 /// PrintDiagnosticCategories - Implement the --print-diagnostic-categories
@@ -1166,6 +1162,10 @@ bool Driver::HandleImmediateArgs(const C
   if (C.getArgs().hasArg(options::OPT__version)) {
     // Follow gcc behavior and use stdout for --version and stderr for -v.
     PrintVersion(C, llvm::outs());
+
+    // Print registered targets.
+    llvm::outs() << '\n';
+    llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs());
     return false;
   }
 




More information about the cfe-commits mailing list