@@ -39,10 +39,9 @@ using llvm::BCVBR;
3939
4040// / Every .moddepcache file begins with these 4 bytes, for easy identification.
4141const unsigned char MODULE_DEPENDENCY_CACHE_FORMAT_SIGNATURE[] = {' I' , ' M' , ' D' ,' C' };
42- const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR =
43- 7 ; // isSystem
42+ const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR = 8 ;
4443// / Increment this on every change.
45- const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MINOR = 1 ;
44+ const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MINOR = 0 ;
4645
4746// / Various identifiers in this format will rely on having their strings mapped
4847// / using this ID.
@@ -57,6 +56,14 @@ using IsFrameworkField = BCFixed<1>;
5756using IsSystemField = BCFixed<1 >;
5857// / A bit that indicates whether or not a module is that of a static archive
5958using IsStaticField = BCFixed<1 >;
59+ // / A bit taht indicates whether or not a link library is a force-load one
60+ using IsForceLoadField = BCFixed<1 >;
61+ // / A bit taht indicates whether or not an import statement is optional
62+ using IsOptionalImport = BCFixed<1 >;
63+
64+ // / Source location fields
65+ using LineNumberField = BCFixed<32 >;
66+ using ColumnNumberField = BCFixed<32 >;
6067
6168// / Arrays of various identifiers, distinguished for readability
6269using IdentifierIDArryField = llvm::BCArray<IdentifierIDField>;
@@ -65,9 +72,14 @@ using ModuleIDArryField = llvm::BCArray<IdentifierIDField>;
6572// / Identifiers used to refer to the above arrays
6673using FileIDArrayIDField = IdentifierIDField;
6774using ContextHashIDField = IdentifierIDField;
75+ using ModuleCacheKeyIDField = IdentifierIDField;
6876using ImportArrayIDField = IdentifierIDField;
77+ using LinkLibrariesArrayIDField = IdentifierIDField;
78+ using MacroDependenciesArrayIDField = IdentifierIDField;
6979using FlagIDArrayIDField = IdentifierIDField;
7080using DependencyIDArrayIDField = IdentifierIDField;
81+ using AuxiliaryFilesArrayIDField = IdentifierIDField;
82+ using SourceLocationIDArrayIDField = IdentifierIDField;
7183
7284// / The ID of the top-level block containing the dependency graph
7385const unsigned GRAPH_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID;
@@ -76,11 +88,20 @@ const unsigned GRAPH_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID;
7688// / zero or more IDENTIFIER records that contain various strings seen in the graph
7789// / (e.g. file names or compiler flags), followed by zero or more IDENTIFIER_ARRAY records
7890// / which are arrays of identifiers seen in the graph (e.g. list of source files or list of compile flags),
91+ // / followed by zero or more LINK_LIBRARY_NODE records along with associated
92+ // /
7993// / followed by zero or more MODULE_NODE, *_DETAILS_NODE pairs of records.
8094namespace graph_block {
8195enum {
8296 METADATA = 1 ,
8397 MODULE_NODE,
98+ LINK_LIBRARY_NODE,
99+ LINK_LIBRARY_ARRAY_NODE,
100+ MACRO_DEPENDENCY_NODE,
101+ MACRO_DEPENDENCY_ARRAY_NODE,
102+ IMPORT_STATEMENT_NODE,
103+ IMPORT_STATEMENT_ARRAY_NODE,
104+ OPTIONAL_IMPORT_STATEMENT_ARRAY_NODE,
84105 SWIFT_INTERFACE_MODULE_DETAILS_NODE,
85106 SWIFT_SOURCE_MODULE_DETAILS_NODE,
86107 SWIFT_PLACEHOLDER_MODULE_DETAILS_NODE,
@@ -95,7 +116,7 @@ using MetadataLayout = BCRecordLayout<
95116 METADATA, // ID
96117 BCFixed<16 >, // Inter-Module Dependency graph format major version
97118 BCFixed<16 >, // Inter-Module Dependency graph format minor version
98- BCBlob // Compiler version string
119+ BCBlob // Scanner Invocation Context Hash
99120 >;
100121
101122// After the metadata record, we have zero or more identifier records,
@@ -117,6 +138,43 @@ using IdentifierNodeLayout = BCRecordLayout<IDENTIFIER_NODE, BCBlob>;
117138using IdentifierArrayLayout =
118139 BCRecordLayout<IDENTIFIER_ARRAY_NODE, IdentifierIDArryField>;
119140
141+ // ACTODO: Comment
142+ using LinkLibraryLayout =
143+ BCRecordLayout<LINK_LIBRARY_NODE, // ID
144+ IdentifierIDField, // libraryName
145+ IsFrameworkField, // isFramework
146+ IsForceLoadField // forceLoad
147+ >;
148+ // ACTODO: Comment
149+ using LinkLibraryArrayLayout =
150+ BCRecordLayout<LINK_LIBRARY_ARRAY_NODE, IdentifierIDArryField>;
151+
152+ // ACTODO: Comment
153+ using MacroDependencyLayout =
154+ BCRecordLayout<MACRO_DEPENDENCY_NODE, // ID
155+ IdentifierIDField, // macroModuleName
156+ IdentifierIDField, // libraryPath
157+ IdentifierIDField // executablePath
158+ >;
159+ // ACTODO: Comment
160+ using MacroDependencyArrayLayout =
161+ BCRecordLayout<MACRO_DEPENDENCY_ARRAY_NODE, IdentifierIDArryField>;
162+
163+ // ACTODO: Comment
164+ using ImportStatementLayout =
165+ BCRecordLayout<IMPORT_STATEMENT_NODE, // ID
166+ IdentifierIDField, // importIdentifier
167+ IdentifierIDField, // bufferIdentifier
168+ LineNumberField, // lineNumber
169+ ColumnNumberField, // columnNumber
170+ IsOptionalImport // isOptional
171+ >;
172+ // ACTODO: Comment
173+ using ImportStatementArrayLayout =
174+ BCRecordLayout<IMPORT_STATEMENT_ARRAY_NODE, IdentifierIDArryField>;
175+ using OptionalImportStatementArrayLayout =
176+ BCRecordLayout<OPTIONAL_IMPORT_STATEMENT_ARRAY_NODE, IdentifierIDArryField>;
177+
120178// After the array records, we have a sequence of Module info
121179// records, each of which is followed by one of:
122180// - SwiftInterfaceModuleDetails
@@ -125,12 +183,18 @@ using IdentifierArrayLayout =
125183// - SwiftPlaceholderModuleDetails
126184// - ClangModuleDetails
127185using ModuleInfoLayout =
128- BCRecordLayout<MODULE_NODE, // ID
129- IdentifierIDField, // moduleName
130- ContextHashIDField, // contextHash
131- ImportArrayIDField, // moduleImports
132- ImportArrayIDField, // optionalModuleImports
133- DependencyIDArrayIDField // resolvedDirectModuleDependencies
186+ BCRecordLayout<MODULE_NODE, // ID
187+ IdentifierIDField, // moduleName
188+ ImportArrayIDField, // imports
189+ ImportArrayIDField, // optionalImports
190+ LinkLibrariesArrayIDField, // linkLibraries
191+ MacroDependenciesArrayIDField, // macroDependencies
192+ DependencyIDArrayIDField, // importedSwiftModules
193+ DependencyIDArrayIDField, // importedClangModules
194+ DependencyIDArrayIDField, // crossImportOverlayModules
195+ DependencyIDArrayIDField, // swiftOverlayDependencies
196+ ModuleCacheKeyIDField, // moduleCacheKey
197+ AuxiliaryFilesArrayIDField // auxiliaryFiles
134198 >;
135199
136200using SwiftInterfaceModuleDetailsLayout =
@@ -147,7 +211,6 @@ using SwiftInterfaceModuleDetailsLayout =
147211 FileIDArrayIDField, // sourceFiles
148212 FileIDArrayIDField, // bridgingSourceFiles
149213 IdentifierIDField, // bridgingModuleDependencies
150- DependencyIDArrayIDField, // swiftOverlayDependencies
151214 IdentifierIDField, // CASFileSystemRootID
152215 IdentifierIDField, // bridgingHeaderIncludeTree
153216 IdentifierIDField, // moduleCacheKey
@@ -161,7 +224,6 @@ using SwiftSourceModuleDetailsLayout =
161224 FileIDArrayIDField, // sourceFiles
162225 FileIDArrayIDField, // bridgingSourceFiles
163226 FileIDArrayIDField, // bridgingModuleDependencies
164- DependencyIDArrayIDField, // swiftOverlayDependencies
165227 IdentifierIDField, // CASFileSystemRootID
166228 IdentifierIDField, // bridgingHeaderIncludeTree
167229 FlagIDArrayIDField, // buildCommandLine
@@ -173,8 +235,8 @@ using SwiftBinaryModuleDetailsLayout =
173235 FileIDField, // compiledModulePath
174236 FileIDField, // moduleDocPath
175237 FileIDField, // moduleSourceInfoPath
176- DependencyIDArrayIDField, // swiftOverlayDependencies
177238 FileIDField, // headerImport
239+ FileIDField, // definingInterfacePath
178240 IdentifierIDField, // headerModuleDependencies
179241 FileIDArrayIDField, // headerSourceFiles
180242 IsFrameworkField, // isFramework
@@ -220,7 +282,7 @@ bool readInterModuleDependenciesCache(llvm::StringRef path,
220282// / Returns true if there was an error.
221283bool writeInterModuleDependenciesCache (DiagnosticEngine &diags,
222284 llvm::vfs::OutputBackend &backend,
223- llvm::StringRef path ,
285+ llvm::StringRef outputPath ,
224286 const ModuleDependenciesCache &cache);
225287
226288// / Tries to write out the given dependency cache with the given
0 commit comments