mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AST] Make it possible to find what Swift version was used to build a module
For imported modules the version is empty because they don't carry this information.
This commit is contained in:
@@ -3935,3 +3935,17 @@ bool IsNonUserModuleRequest::evaluate(Evaluator &evaluator, ModuleDecl *mod) con
|
||||
return (!runtimePath.empty() && pathStartsWith(runtimePath, modulePath)) ||
|
||||
(!sdkPath.empty() && pathStartsWith(sdkPath, modulePath));
|
||||
}
|
||||
|
||||
version::Version ModuleDecl::getLanguageVersionBuiltWith() const {
|
||||
for (auto *F : getFiles()) {
|
||||
auto *LD = dyn_cast<LoadedFile>(F);
|
||||
if (!LD)
|
||||
continue;
|
||||
|
||||
auto version = LD->getLanguageVersionBuiltWith();
|
||||
if (!version.empty())
|
||||
return version;
|
||||
}
|
||||
|
||||
return version::Version();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user