[cfe-commits] r76632 - in /cfe/trunk: include/clang/Driver/Driver.h lib/Driver/Driver.cpp
Daniel Dunbar
daniel at zuster.org
Tue Jul 21 13:06:59 PDT 2009
Author: ddunbar
Date: Tue Jul 21 15:06:58 2009
New Revision: 76632
URL: http://llvm.org/viewvc/llvm-project?rev=76632&view=rev
Log:
driver: Print --version on stdout, to match gcc.
- Patch by Jean-Daniel Dupas
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=76632&r1=76631&r2=76632&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Tue Jul 21 15:06:58 2009
@@ -21,6 +21,9 @@
#include <set>
#include <string>
+namespace llvm {
+ class raw_ostream;
+}
namespace clang {
namespace driver {
class Action;
@@ -185,7 +188,7 @@
void PrintOptions(const ArgList &Args) const;
/// PrintVersion - Print the driver version.
- void PrintVersion(const Compilation &C) const;
+ void PrintVersion(const Compilation &C, llvm::raw_ostream &OS) const;
/// GetFilePath - Lookup \arg Name in the list of file search paths.
///
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=76632&r1=76631&r2=76632&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Jul 21 15:06:58 2009
@@ -385,7 +385,7 @@
OS.flush();
}
-void Driver::PrintVersion(const Compilation &C) const {
+void Driver::PrintVersion(const Compilation &C, llvm::raw_ostream &OS) const {
static char buf[] = "$URL$";
char *zap = strstr(buf, "/lib/Driver");
if (zap)
@@ -402,17 +402,16 @@
#endif
// FIXME: The following handlers should use a callback mechanism, we
// don't know what the client would like to do.
-
- llvm::errs() << "clang version " CLANG_VERSION_STRING " ("
+ OS << "clang version " CLANG_VERSION_STRING " ("
<< vers << " " << revision << ")" << '\n';
const ToolChain &TC = C.getDefaultToolChain();
- llvm::errs() << "Target: " << TC.getTripleString() << '\n';
+ OS << "Target: " << TC.getTripleString() << '\n';
// Print the threading model.
//
// FIXME: Implement correctly.
- llvm::errs() << "Thread model: " << "posix" << '\n';
+ OS << "Thread model: " << "posix" << '\n';
}
bool Driver::HandleImmediateArgs(const Compilation &C) {
@@ -432,13 +431,14 @@
}
if (C.getArgs().hasArg(options::OPT__version)) {
- PrintVersion(C);
+ // Follow gcc behavior and use stdout for --version and stderr for -v
+ PrintVersion(C, llvm::outs());
return false;
}
if (C.getArgs().hasArg(options::OPT_v) ||
C.getArgs().hasArg(options::OPT__HASH_HASH_HASH)) {
- PrintVersion(C);
+ PrintVersion(C, llvm::errs());
SuppressMissingInputWarning = true;
}
More information about the cfe-commits
mailing list