Improve diagnostic for broken module interfaces

Currently, when a swiftinterface file fails to load, we emit the specific diagnostics for the failures, followed by a generic “failed to load module ‘Foo’” message. This PR improves that final diagnostic, particularly when the cause may be that the interface was emitted by a newer compiler using backwards-incompatible syntax.
This commit is contained in:
Brent Royal-Gordon
2020-03-13 16:56:18 -07:00
parent 000572d56c
commit a7a5e340aa
8 changed files with 80 additions and 15 deletions

View File

@@ -23,6 +23,7 @@
namespace swift {
class ASTContext;
class ModuleDecl;
/// Options for controlling the generation of the .swiftinterface output.
@@ -45,8 +46,10 @@ struct ModuleInterfaceOptions {
};
extern version::Version InterfaceFormatVersion;
std::string getSwiftInterfaceCompilerVersionForCurrentCompiler(ASTContext &ctx);
llvm::Regex getSwiftInterfaceFormatVersionRegex();
llvm::Regex getSwiftInterfaceCompilerVersionRegex();
llvm::Regex getSwiftInterfaceModuleFlagsRegex();
/// Emit a stable module interface for \p M, which can be used by a client