[Dependency Scanning] Model main module as separate dependency kind: SwiftSource

These kinds of modules differ from `SwiftTextual` modules in that they do not have an interface and have source-files.
It is cleaner to enforce this distinction with types, instead of checking for interface optionality everywhere.
This commit is contained in:
Artem Chikin
2021-09-13 16:46:54 -07:00
parent 8cd8ca01ad
commit e64a40451b
16 changed files with 473 additions and 158 deletions

View File

@@ -37,7 +37,7 @@ using llvm::BCVBR;
/// Every .moddepcache file begins with these 4 bytes, for easy identification.
const unsigned char MODULE_DEPENDENCY_CACHE_FORMAT_SIGNATURE[] = {'I', 'M', 'D',
'C'};
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR = 1;
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR = 2;
/// Increment this on every change.
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MINOR = 0;
@@ -72,7 +72,8 @@ namespace graph_block {
enum {
METADATA = 1,
MODULE_NODE,
SWIFT_TEXTUAL_MODULE_DETAILS_NODE,
SWIFT_INTERFACE_MODULE_DETAILS_NODE,
SWIFT_SOURCE_MODULE_DETAILS_NODE,
SWIFT_PLACEHOLDER_MODULE_DETAILS_NODE,
SWIFT_BINARY_MODULE_DETAILS_NODE,
CLANG_MODULE_DETAILS_NODE,
@@ -109,7 +110,8 @@ using IdentifierArrayLayout =
// After the array records, we have a sequence of Module info
// records, each of which is followed by one of:
// - SwiftTextualModuleDetails
// - SwiftInterfaceModuleDetails
// - SwiftSourceModuleDetails
// - SwiftBinaryModuleDetails
// - SwiftPlaceholderModuleDetails
// - ClangModuleDetails
@@ -119,8 +121,8 @@ using ModuleInfoLayout =
DependencyIDArrayIDField // directDependencies
>;
using SwiftTextualModuleDetailsLayout =
BCRecordLayout<SWIFT_TEXTUAL_MODULE_DETAILS_NODE, // ID
using SwiftInterfaceModuleDetailsLayout =
BCRecordLayout<SWIFT_INTERFACE_MODULE_DETAILS_NODE, // ID
FileIDField, // swiftInterfaceFile
FileIDArrayIDField, // compiledModuleCandidates
FlagIDArrayIDField, // buildCommandLine
@@ -130,7 +132,16 @@ using SwiftTextualModuleDetailsLayout =
FileIDField, // bridgingHeaderFile
FileIDArrayIDField, // sourceFiles
FileIDArrayIDField, // bridgingSourceFiles
IdentifierIDField // bridgingModuleDependencies
FileIDArrayIDField // bridgingModuleDependencies
>;
using SwiftSourceModuleDetailsLayout =
BCRecordLayout<SWIFT_SOURCE_MODULE_DETAILS_NODE, // ID
FlagIDArrayIDField, // extraPCMArgs
FileIDField, // bridgingHeaderFile
FileIDArrayIDField, // sourceFiles
FileIDArrayIDField, // bridgingSourceFiles
FileIDArrayIDField // bridgingModuleDependencies
>;
using SwiftBinaryModuleDetailsLayout =