[serialization] Diagnose loading modules from older Swifts.

...with a better message than the generic "older version of the
compiler" one, when we know it's actually a different version of
Swift proper.

This still uses the same internal module version numbers to check
if the module is compatible; the presentation of language versions
is a diagnostic thing only.

Speaking of module version numbers, this deliberately does NOT
increment VERSION_MINOR; it's implemented in a backwards-compatible
way.

This will only work going forwards, of course; all existing modules
don't have a short version string, and I don't feel comfortable
assuming all older modules we might encounter are "Swift 2.2".

rdar://problem/25680392
This commit is contained in:
Jordan Rose
2016-04-29 14:47:46 -07:00
parent 22cef3ebd1
commit 8f820dea2b
18 changed files with 99 additions and 84 deletions

View File

@@ -48,6 +48,8 @@ static void printValidationInfo(llvm::StringRef data) {
if (info.status != swift::serialization::Status::Valid)
return;
if (!info.shortVersion.empty())
llvm::outs() << "- Swift Version: " << info.shortVersion << "\n";
llvm::outs() << "- Target: " << info.targetTriple << "\n";
if (!extendedInfo.getSDKPath().empty())
llvm::outs() << "- SDK path: " << extendedInfo.getSDKPath() << "\n";