mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Add an option to output modules regardless of errors
Adds a new frontend option "-experimental-allow-module-with-compiler-errors". If any compilation errors occur while generating the .swiftmodule, this mode will skip SIL entirely and only serialize the (likey invalid) AST. This existence of this option during generation is serialized into the resulting .swiftmodule. Errors found in deserialization are only allowed if it is set. Primarily intended for IDE requests (eg. indexing and code completion) to ensure robust cross-module results, despite possible errors. Resolves rdar://69815975
This commit is contained in:
@@ -56,7 +56,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
|
||||
/// describe what change you made. The content of this comment isn't important;
|
||||
/// it just ensures a conflict if two people change the module format.
|
||||
/// Don't worry about adhering to the 80-column limit for this line.
|
||||
const uint16_t SWIFTMODULE_VERSION_MINOR = 585; // hop_to_executor instruction
|
||||
const uint16_t SWIFTMODULE_VERSION_MINOR = 586; // allow errors in modules
|
||||
|
||||
/// A standard hash seed used for all string hashes in a serialized module.
|
||||
///
|
||||
@@ -787,7 +787,8 @@ namespace options_block {
|
||||
IS_TESTABLE,
|
||||
RESILIENCE_STRATEGY,
|
||||
ARE_PRIVATE_IMPORTS_ENABLED,
|
||||
IS_IMPLICIT_DYNAMIC_ENABLED
|
||||
IS_IMPLICIT_DYNAMIC_ENABLED,
|
||||
IS_ALLOW_MODULE_WITH_COMPILER_ERRORS_ENABLED
|
||||
};
|
||||
|
||||
using SDKPathLayout = BCRecordLayout<
|
||||
@@ -821,6 +822,10 @@ namespace options_block {
|
||||
RESILIENCE_STRATEGY,
|
||||
BCFixed<2>
|
||||
>;
|
||||
|
||||
using IsAllowModuleWithCompilerErrorsEnabledLayout = BCRecordLayout<
|
||||
IS_ALLOW_MODULE_WITH_COMPILER_ERRORS_ENABLED
|
||||
>;
|
||||
}
|
||||
|
||||
/// The record types within the input block.
|
||||
@@ -919,6 +924,12 @@ namespace decls_block {
|
||||
BCArray<BCVBR<6>>
|
||||
>;
|
||||
|
||||
/// A placeholder for invalid types
|
||||
using ErrorTypeLayout = BCRecordLayout<
|
||||
ERROR_TYPE,
|
||||
TypeIDField // original type (if any)
|
||||
>;
|
||||
|
||||
using BuiltinAliasTypeLayout = BCRecordLayout<
|
||||
BUILTIN_ALIAS_TYPE,
|
||||
DeclIDField, // typealias decl
|
||||
|
||||
Reference in New Issue
Block a user