Skip to content

Commit 6fdb788

Browse files
committed
[Dependency Scanning] Add Link Libraries to the dependency scanner cache serialization format
1 parent a46e331 commit 6fdb788

File tree

5 files changed

+407
-248
lines changed

5 files changed

+407
-248
lines changed

include/swift/DependencyScan/SerializedModuleDependencyCacheFormat.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ using FileIDArrayIDField = IdentifierIDField;
7373
using ContextHashIDField = IdentifierIDField;
7474
using ModuleCacheKeyIDField = IdentifierIDField;
7575
using ImportArrayIDField = IdentifierIDField;
76+
using LinkLibrariesArrayIDField = IdentifierIDField;
7677
using FlagIDArrayIDField = IdentifierIDField;
7778
using DependencyIDArrayIDField = IdentifierIDField;
7879
using AuxiliaryFilesArrayIDField = IdentifierIDField;
@@ -85,12 +86,15 @@ const unsigned GRAPH_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID;
8586
/// zero or more IDENTIFIER records that contain various strings seen in the graph
8687
/// (e.g. file names or compiler flags), followed by zero or more IDENTIFIER_ARRAY records
8788
/// which are arrays of identifiers seen in the graph (e.g. list of source files or list of compile flags),
89+
/// followed by zero or more LINK_LIBRARY_NODE records along with associated
90+
///
8891
/// followed by zero or more MODULE_NODE, *_DETAILS_NODE pairs of records.
8992
namespace graph_block {
9093
enum {
9194
METADATA = 1,
9295
MODULE_NODE,
9396
LINK_LIBRARY_NODE,
97+
LINK_LIBRARY_ARRAY_NODE,
9498
SOURCE_LOCATION_NODE,
9599
IMPORT_STATEMENT_NODE,
96100
SWIFT_INTERFACE_MODULE_DETAILS_NODE,
@@ -129,6 +133,9 @@ using IdentifierNodeLayout = BCRecordLayout<IDENTIFIER_NODE, BCBlob>;
129133
using IdentifierArrayLayout =
130134
BCRecordLayout<IDENTIFIER_ARRAY_NODE, IdentifierIDArryField>;
131135

136+
using LinkLibraryArrayLayout =
137+
BCRecordLayout<LINK_LIBRARY_ARRAY_NODE, IdentifierIDArryField>;
138+
132139
using LinkLibraryLayout =
133140
BCRecordLayout<LINK_LIBRARY_NODE, // ID
134141
IdentifierIDField, // libraryName
@@ -157,12 +164,11 @@ using ImportStatementLayout =
157164
// - SwiftPlaceholderModuleDetails
158165
// - ClangModuleDetails
159166
using ModuleInfoLayout =
160-
BCRecordLayout<MODULE_NODE, // ID
161-
IdentifierIDField, // moduleName
162-
ContextHashIDField, // contextHash
163-
ImportArrayIDField, // moduleImports
164-
ImportArrayIDField, // optionalModuleImports
165-
// ACTODO: LinkLibrariesArrayIDField, // linkLibraries
167+
BCRecordLayout<MODULE_NODE, // ID
168+
IdentifierIDField, // moduleName
169+
ImportArrayIDField, // moduleImports
170+
ImportArrayIDField, // optionalModuleImports
171+
LinkLibrariesArrayIDField, // linkLibraries
166172
DependencyIDArrayIDField, // importedSwiftModules
167173
DependencyIDArrayIDField, // importedClangModules
168174
DependencyIDArrayIDField, // crossImportOverlayModules
@@ -211,6 +217,7 @@ using SwiftBinaryModuleDetailsLayout =
211217
FileIDField, // moduleDocPath
212218
FileIDField, // moduleSourceInfoPath
213219
FileIDField, // headerImport
220+
FileIDField, // definingInterfacePath
214221
IdentifierIDField, // headerModuleDependencies
215222
FileIDArrayIDField, // headerSourceFiles
216223
IsFrameworkField, // isFramework

lib/AST/ModuleDependencies.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ bool ModuleDependencyInfo::isTextualSwiftModule() const {
4444
return isSwiftInterfaceModule() || isSwiftSourceModule();
4545
}
4646

47-
ModuleDependencyKind &operator++(ModuleDependencyKind &e) {
48-
if (e == ModuleDependencyKind::LastKind) {
49-
llvm_unreachable(
50-
"Attempting to increment last enum value on ModuleDependencyKind");
47+
namespace {
48+
ModuleDependencyKind &operator++(ModuleDependencyKind &e) {
49+
if (e == ModuleDependencyKind::LastKind) {
50+
llvm_unreachable(
51+
"Attempting to increment last enum value on ModuleDependencyKind");
52+
}
53+
e = ModuleDependencyKind(
54+
static_cast<std::underlying_type<ModuleDependencyKind>::type>(e) + 1);
55+
return e;
5156
}
52-
e = ModuleDependencyKind(
53-
static_cast<std::underlying_type<ModuleDependencyKind>::type>(e) + 1);
54-
return e;
5557
}
56-
5758
bool ModuleDependencyInfo::isSwiftInterfaceModule() const {
5859
return isa<SwiftInterfaceModuleDependenciesStorage>(storage.get());
5960
}

0 commit comments

Comments
 (0)