Add a header containing the Clang version; make the driver use this
Clang version value rather than hard-coding "1.0".

Add PCH and Clang version information into the PCH file. Reject PCH
files with the wrong version information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70264 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index d88f1b3..d6a046e 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -22,6 +22,8 @@
 #include "clang/Driver/ToolChain.h"
 #include "clang/Driver/Types.h"
 
+#include "clang/Basic/Version.h"
+
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
@@ -353,8 +355,8 @@
   // 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";
+  llvm::errs() << "clang version " CLANG_VERSION_STRING " (" 
+               << vers << " " << revision << ")" << "\n";
 
   const ToolChain &TC = C.getDefaultToolChain();
   llvm::errs() << "Target: " << TC.getTripleString() << '\n';
@@ -366,8 +368,7 @@
   // in practice.
 
   if (C.getArgs().hasArg(options::OPT_dumpversion)) {
-    // FIXME: Do not hardcode clang version.
-    llvm::outs() << "1.0\n";
+    llvm::outs() << CLANG_VERSION_STRING "\n";
     return false;
   }