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/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 24e4e2b..c1cb87b 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -928,7 +928,13 @@
return IgnorePCH;
break;
- case pch::TARGET_TRIPLE: {
+ case pch::METADATA: {
+ if (Record[0] != pch::VERSION_MAJOR) {
+ Diag(Record[0] < pch::VERSION_MAJOR? diag::warn_pch_version_too_old
+ : diag::warn_pch_version_too_new);
+ return IgnorePCH;
+ }
+
std::string TargetTriple(BlobStart, BlobLen);
if (TargetTriple != PP.getTargetInfo().getTargetTriple()) {
Diag(diag::warn_pch_target_triple)