From e06dc219a869d73b6c9a398a2dee0aa2d4e2dcf0 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 4 Apr 2009 05:17:38 +0000 Subject: [PATCH] Driver: Handle -dumpversion, this is used by some configuration scripts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68418 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.def | 2 +- lib/Driver/Driver.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def index 681c8ebbb9..de5c0d19c7 100644 --- a/include/clang/Driver/Options.def +++ b/include/clang/Driver/Options.def @@ -384,7 +384,7 @@ OPTION("-dead_strip", dead__strip, Flag, INVALID, INVALID, "", 0, 0, 0) OPTION("-dependency-file", dependency_file, Separate, INVALID, INVALID, "", 0, 0, 0) OPTION("-dumpmachine", dumpmachine, Flag, INVALID, INVALID, "u", 0, 0, 0) OPTION("-dumpspecs", dumpspecs, Flag, INVALID, INVALID, "u", 0, 0, 0) -OPTION("-dumpversion", dumpversion, Flag, INVALID, INVALID, "u", 0, 0, 0) +OPTION("-dumpversion", dumpversion, Flag, INVALID, INVALID, "", 0, 0, 0) OPTION("-dylib_file", dylib__file, Separate, INVALID, INVALID, "", 0, 0, 0) OPTION("-dylinker_install_name", dylinker__install__name, JoinedOrSeparate, INVALID, INVALID, "", 0, 0, 0) OPTION("-dylinker", dylinker, Flag, INVALID, INVALID, "", 0, 0, 0) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 74c4b07975..68ff8bc8b0 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -312,6 +312,8 @@ void Driver::PrintVersion(const Compilation &C) const { #endif // FIXME: The following handlers should use a callback mechanism, we // don't know what the client would like to do. + + // FIXME: Do not hardcode clang version. llvm::errs() << "clang version 1.0 (" << vers << " " << revision << ")" << "\n"; const ToolChain &TC = C.getDefaultToolChain(); @@ -323,6 +325,12 @@ bool Driver::HandleImmediateArgs(const Compilation &C) { // place, but we don't expect inconsistencies w.r.t. that to matter // in practice. + if (C.getArgs().hasArg(options::OPT_dumpversion)) { + // FIXME: Do not hardcode clang version. + llvm::outs() << "1.0\n"; + return false; + } + if (C.getArgs().hasArg(options::OPT__help)) { PrintHelp(); return false; -- 2.40.0