Skip to content

Commit 477ba0d

Browse files
committed
[Dependency Scanning] Remove references to per-triple PCM variant compilation
1 parent 41e4712 commit 477ba0d

23 files changed

+197
-326
lines changed

include/swift-c/DependencyScan/DependencyScan.h

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/// The version constants for the SwiftDependencyScan C API.
2525
/// SWIFTSCAN_VERSION_MINOR should increase when there are API additions.
2626
/// SWIFTSCAN_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
27-
#define SWIFTSCAN_VERSION_MAJOR 1
27+
#define SWIFTSCAN_VERSION_MAJOR 2
2828
#define SWIFTSCAN_VERSION_MINOR 0
2929

3030
SWIFTSCAN_BEGIN_DECLS
@@ -94,20 +94,20 @@ typedef struct {
9494
size_t count;
9595
} swiftscan_diagnostic_set_t;
9696

97-
//=== Batch Scan Input Specification --------------------------------------===//
97+
//=== Batch Scan Input Specification -------DEPRECATED--------------------===//
9898

99-
/// Opaque container to a container of batch scan entry information.
100-
typedef struct swiftscan_batch_scan_entry_s *swiftscan_batch_scan_entry_t;
99+
/// Opaque container to a container of batch scan entry information.
100+
typedef struct swiftscan_batch_scan_entry_s *swiftscan_batch_scan_entry_t;
101101

102-
typedef struct {
103-
swiftscan_batch_scan_entry_t *modules;
104-
size_t count;
105-
} swiftscan_batch_scan_input_t;
102+
typedef struct {
103+
swiftscan_batch_scan_entry_t *modules;
104+
size_t count;
105+
} swiftscan_batch_scan_input_t;
106106

107-
typedef struct {
108-
swiftscan_dependency_graph_t *results;
109-
size_t count;
110-
} swiftscan_batch_scan_result_t;
107+
typedef struct {
108+
swiftscan_dependency_graph_t *results;
109+
size_t count;
110+
} swiftscan_batch_scan_result_t;
111111

112112
//=== Scanner Invocation Specification ------------------------------------===//
113113

@@ -194,9 +194,10 @@ SWIFTSCAN_PUBLIC swiftscan_string_set_t *
194194
swiftscan_swift_textual_detail_get_bridging_pch_command_line(
195195
swiftscan_module_details_t details);
196196

197+
// DEPRECATED
197198
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
198-
swiftscan_swift_textual_detail_get_extra_pcm_args(
199-
swiftscan_module_details_t details);
199+
swiftscan_swift_textual_detail_get_extra_pcm_args(
200+
swiftscan_module_details_t details);
200201

201202
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
202203
swiftscan_swift_textual_detail_get_context_hash(
@@ -283,6 +284,7 @@ swiftscan_clang_detail_get_context_hash(swiftscan_module_details_t details);
283284
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
284285
swiftscan_clang_detail_get_command_line(swiftscan_module_details_t details);
285286

287+
// DEPRECATED
286288
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
287289
swiftscan_clang_detail_get_captured_pcm_args(swiftscan_module_details_t details);
288290

@@ -292,6 +294,40 @@ swiftscan_clang_detail_get_cas_fs_root_id(swiftscan_module_details_t details);
292294
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
293295
swiftscan_clang_detail_get_module_cache_key(swiftscan_module_details_t details);
294296

297+
//=== Batch Scan Input Functions ------DEPRECATED---------------------------===//
298+
/// Deprecated
299+
SWIFTSCAN_PUBLIC swiftscan_batch_scan_input_t *
300+
swiftscan_batch_scan_input_create();
301+
/// Deprecated
302+
SWIFTSCAN_PUBLIC void
303+
swiftscan_batch_scan_input_set_modules(swiftscan_batch_scan_input_t *input,
304+
int count,
305+
swiftscan_batch_scan_entry_t *modules);
306+
/// Deprecated
307+
SWIFTSCAN_PUBLIC swiftscan_batch_scan_entry_t
308+
swiftscan_batch_scan_entry_create();
309+
/// Deprecated
310+
SWIFTSCAN_PUBLIC void
311+
swiftscan_batch_scan_entry_set_module_name(swiftscan_batch_scan_entry_t entry,
312+
const char *name);
313+
/// Deprecated
314+
SWIFTSCAN_PUBLIC void
315+
swiftscan_batch_scan_entry_set_arguments(swiftscan_batch_scan_entry_t entry,
316+
const char *arguments);
317+
/// Deprecated
318+
SWIFTSCAN_PUBLIC void
319+
swiftscan_batch_scan_entry_set_is_swift(swiftscan_batch_scan_entry_t entry,
320+
bool is_swift);
321+
/// Deprecated
322+
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
323+
swiftscan_batch_scan_entry_get_module_name(swiftscan_batch_scan_entry_t entry);
324+
/// Deprecated
325+
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
326+
swiftscan_batch_scan_entry_get_arguments(swiftscan_batch_scan_entry_t entry);
327+
/// Deprecated
328+
SWIFTSCAN_PUBLIC bool
329+
swiftscan_batch_scan_entry_get_is_swift(swiftscan_batch_scan_entry_t entry);
330+
295331
//=== Prescan Result Functions --------------------------------------------===//
296332

297333
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
@@ -340,6 +376,16 @@ swiftscan_dependency_graph_dispose(swiftscan_dependency_graph_t result);
340376
SWIFTSCAN_PUBLIC void
341377
swiftscan_import_set_dispose(swiftscan_import_set_t result);
342378

379+
/// Deprecated
380+
SWIFTSCAN_PUBLIC void
381+
swiftscan_batch_scan_entry_dispose(swiftscan_batch_scan_entry_t entry);
382+
/// Deprecated
383+
SWIFTSCAN_PUBLIC void
384+
swiftscan_batch_scan_input_dispose(swiftscan_batch_scan_input_t *input);
385+
/// Deprecated
386+
SWIFTSCAN_PUBLIC void
387+
swiftscan_batch_scan_result_dispose(swiftscan_batch_scan_result_t *result);
388+
/// Deprecated
343389
SWIFTSCAN_PUBLIC void
344390
swiftscan_scan_invocation_dispose(swiftscan_scan_invocation_t invocation);
345391

@@ -383,6 +429,11 @@ SWIFTSCAN_PUBLIC swiftscan_dependency_graph_t swiftscan_dependency_graph_create(
383429
SWIFTSCAN_PUBLIC swiftscan_import_set_t swiftscan_import_set_create(
384430
swiftscan_scanner_t scanner, swiftscan_scan_invocation_t invocation);
385431

432+
/// Deprecated
433+
SWIFTSCAN_PUBLIC swiftscan_batch_scan_result_t *
434+
swiftscan_batch_scan_result_create(swiftscan_scanner_t scanner,
435+
swiftscan_batch_scan_input_t *batch_input,
436+
swiftscan_scan_invocation_t invocation);
386437

387438
//=== Scanner Diagnostics -------------------------------------------------===//
388439
/// For the specified \c scanner instance, query all insofar emitted diagnostics

include/swift/AST/ModuleDependencies.h

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -229,19 +229,13 @@ class ModuleDependencyInfoStorageBase {
229229

230230
struct CommonSwiftTextualModuleDependencyDetails {
231231
CommonSwiftTextualModuleDependencyDetails(
232-
ArrayRef<StringRef> extraPCMArgs, ArrayRef<StringRef> buildCommandLine,
232+
ArrayRef<StringRef> buildCommandLine,
233233
StringRef CASFileSystemRootID)
234-
: extraPCMArgs(extraPCMArgs.begin(), extraPCMArgs.end()),
235-
bridgingHeaderFile(std::nullopt),
234+
: bridgingHeaderFile(std::nullopt),
236235
bridgingSourceFiles(), bridgingModuleDependencies(),
237236
buildCommandLine(buildCommandLine.begin(), buildCommandLine.end()),
238237
CASFileSystemRootID(CASFileSystemRootID) {}
239238

240-
/// To build a PCM to be used by this Swift module, we need to append these
241-
/// arguments to the generic PCM build arguments reported from the dependency
242-
/// graph.
243-
const std::vector<std::string> extraPCMArgs;
244-
245239
/// Bridging header file, if there is one.
246240
std::optional<std::string> bridgingHeaderFile;
247241

@@ -299,7 +293,7 @@ class SwiftInterfaceModuleDependenciesStorage
299293
ArrayRef<ScannerImportStatementInfo> moduleImports,
300294
ArrayRef<ScannerImportStatementInfo> optionalModuleImports,
301295
ArrayRef<StringRef> buildCommandLine, ArrayRef<LinkLibrary> linkLibraries,
302-
ArrayRef<StringRef> extraPCMArgs, StringRef contextHash, bool isFramework,
296+
StringRef contextHash, bool isFramework,
303297
bool isStatic, StringRef RootID, StringRef moduleCacheKey,
304298
StringRef userModuleVersion)
305299
: ModuleDependencyInfoStorageBase(ModuleDependencyKind::SwiftInterface,
@@ -310,7 +304,7 @@ class SwiftInterfaceModuleDependenciesStorage
310304
compiledModuleCandidates(compiledModuleCandidates.begin(),
311305
compiledModuleCandidates.end()),
312306
contextHash(contextHash), isFramework(isFramework), isStatic(isStatic),
313-
textualModuleDetails(extraPCMArgs, buildCommandLine, RootID),
307+
textualModuleDetails(buildCommandLine, RootID),
314308
userModuleVersion(userModuleVersion) {}
315309

316310
ModuleDependencyInfoStorageBase *clone() const override {
@@ -348,11 +342,10 @@ class SwiftSourceModuleDependenciesStorage
348342
StringRef RootID, ArrayRef<StringRef> buildCommandLine,
349343
ArrayRef<ScannerImportStatementInfo> moduleImports,
350344
ArrayRef<ScannerImportStatementInfo> optionalModuleImports,
351-
ArrayRef<StringRef> bridgingHeaderBuildCommandLine,
352-
ArrayRef<StringRef> extraPCMArgs)
345+
ArrayRef<StringRef> bridgingHeaderBuildCommandLine)
353346
: ModuleDependencyInfoStorageBase(ModuleDependencyKind::SwiftSource,
354347
moduleImports, optionalModuleImports, {}),
355-
textualModuleDetails(extraPCMArgs, buildCommandLine, RootID),
348+
textualModuleDetails(buildCommandLine, RootID),
356349
testableImports(llvm::StringSet<>()),
357350
bridgingHeaderBuildCommandLine(bridgingHeaderBuildCommandLine.begin(),
358351
bridgingHeaderBuildCommandLine.end()) {}
@@ -476,10 +469,6 @@ class ClangModuleDependencyStorage : public ModuleDependencyInfoStorageBase {
476469
/// The file dependencies
477470
const std::vector<std::string> fileDependencies;
478471

479-
/// The swift-specific PCM arguments captured by this dependencies object
480-
/// as found by the scanning action that discovered it
481-
const std::vector<std::string> capturedPCMArgs;
482-
483472
/// CASID for the Root of CASFS. Empty if CAS is not used.
484473
std::string CASFileSystemRootID;
485474

@@ -493,7 +482,6 @@ class ClangModuleDependencyStorage : public ModuleDependencyInfoStorageBase {
493482
StringRef moduleMapFile, StringRef contextHash,
494483
ArrayRef<std::string> buildCommandLine,
495484
ArrayRef<std::string> fileDependencies,
496-
ArrayRef<std::string> capturedPCMArgs,
497485
ArrayRef<LinkLibrary> linkLibraries,
498486
StringRef CASFileSystemRootID,
499487
StringRef clangIncludeTreeRoot,
@@ -504,7 +492,6 @@ class ClangModuleDependencyStorage : public ModuleDependencyInfoStorageBase {
504492
pcmOutputPath(pcmOutputPath), mappedPCMPath(mappedPCMPath),
505493
moduleMapFile(moduleMapFile), contextHash(contextHash),
506494
buildCommandLine(buildCommandLine), fileDependencies(fileDependencies),
507-
capturedPCMArgs(capturedPCMArgs),
508495
CASFileSystemRootID(CASFileSystemRootID),
509496
CASClangIncludeTreeRootID(clangIncludeTreeRoot), IsSystem(IsSystem) {}
510497

@@ -588,15 +575,15 @@ class ModuleDependencyInfo {
588575
ArrayRef<StringRef> compiledCandidates, ArrayRef<StringRef> buildCommands,
589576
ArrayRef<ScannerImportStatementInfo> moduleImports,
590577
ArrayRef<ScannerImportStatementInfo> optionalModuleImports,
591-
ArrayRef<LinkLibrary> linkLibraries, ArrayRef<StringRef> extraPCMArgs,
578+
ArrayRef<LinkLibrary> linkLibraries,
592579
StringRef contextHash, bool isFramework, bool isStatic,
593580
StringRef CASFileSystemRootID, StringRef moduleCacheKey,
594581
StringRef userModuleVersion) {
595582
return ModuleDependencyInfo(
596583
std::make_unique<SwiftInterfaceModuleDependenciesStorage>(
597584
moduleOutputPath, swiftInterfaceFile, compiledCandidates,
598585
moduleImports, optionalModuleImports,
599-
buildCommands, linkLibraries, extraPCMArgs, contextHash,
586+
buildCommands, linkLibraries, contextHash,
600587
isFramework, isStatic, CASFileSystemRootID, moduleCacheKey,
601588
userModuleVersion));
602589
}
@@ -624,13 +611,11 @@ class ModuleDependencyInfo {
624611
ArrayRef<StringRef> buildCommands,
625612
ArrayRef<ScannerImportStatementInfo> moduleImports,
626613
ArrayRef<ScannerImportStatementInfo> optionalModuleImports,
627-
ArrayRef<StringRef> bridgingHeaderBuildCommands,
628-
ArrayRef<StringRef> extraPCMArgs) {
614+
ArrayRef<StringRef> bridgingHeaderBuildCommands) {
629615
return ModuleDependencyInfo(
630616
std::make_unique<SwiftSourceModuleDependenciesStorage>(
631617
CASFileSystemRootID, buildCommands, moduleImports,
632-
optionalModuleImports, bridgingHeaderBuildCommands,
633-
extraPCMArgs));
618+
optionalModuleImports, bridgingHeaderBuildCommands));
634619
}
635620

636621
static ModuleDependencyInfo
@@ -640,7 +625,6 @@ class ModuleDependencyInfo {
640625
StringRef(), ArrayRef<StringRef>(),
641626
ArrayRef<ScannerImportStatementInfo>(),
642627
ArrayRef<ScannerImportStatementInfo>(),
643-
ArrayRef<StringRef>(),
644628
ArrayRef<StringRef>()));
645629
}
646630

@@ -650,12 +634,11 @@ class ModuleDependencyInfo {
650634
StringRef pcmOutputPath, StringRef mappedPCMPath, StringRef moduleMapFile,
651635
StringRef contextHash, ArrayRef<std::string> nonPathCommandLine,
652636
ArrayRef<std::string> fileDependencies,
653-
ArrayRef<std::string> capturedPCMArgs,
654637
ArrayRef<LinkLibrary> linkLibraries, StringRef CASFileSystemRootID,
655638
StringRef clangIncludeTreeRoot, StringRef moduleCacheKey, bool IsSystem) {
656639
return ModuleDependencyInfo(std::make_unique<ClangModuleDependencyStorage>(
657640
pcmOutputPath, mappedPCMPath, moduleMapFile, contextHash,
658-
nonPathCommandLine, fileDependencies, capturedPCMArgs, linkLibraries,
641+
nonPathCommandLine, fileDependencies, linkLibraries,
659642
CASFileSystemRootID, clangIncludeTreeRoot, moduleCacheKey, IsSystem));
660643
}
661644

include/swift/AST/ModuleLoader.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ struct SubCompilerInstanceInfo {
184184
CompilerInstance* Instance;
185185
StringRef Hash;
186186
ArrayRef<StringRef> BuildArguments;
187-
ArrayRef<StringRef> ExtraPCMArgs;
188187
};
189188

190189
/// Abstract interface for a checker of module interfaces and prebuilt modules.
@@ -213,7 +212,6 @@ struct InterfaceSubContextDelegate {
213212
StringRef outputPath,
214213
SourceLoc diagLoc,
215214
llvm::function_ref<std::error_code(ASTContext&, ModuleDecl*,
216-
ArrayRef<StringRef>,
217215
ArrayRef<StringRef>, StringRef,
218216
StringRef)> action) = 0;
219217
virtual std::error_code runInSubCompilerInstance(StringRef moduleName,

include/swift/DependencyScan/DependencyScanImpl.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ typedef struct {
107107
/// Options to the compile command required to build bridging header.
108108
swiftscan_string_set_t *bridging_pch_command_line;
109109

110-
/// To build a PCM to be used by this Swift module, we need to append these
111-
/// arguments to the generic PCM build arguments reported from the dependency
112-
/// graph.
113-
swiftscan_string_set_t *extra_pcm_args;
114-
115110
/// The hash value that will be used for the generated module
116111
swiftscan_string_ref_t context_hash;
117112

@@ -201,9 +196,6 @@ typedef struct {
201196
/// Options to the compile command required to build this clang modulemap
202197
swiftscan_string_set_t *command_line;
203198

204-
/// The swift-specific PCM arguments captured by this dependencies object
205-
swiftscan_string_set_t *captured_pcm_args;
206-
207199
/// The CASID for CASFileSystemRoot
208200
swiftscan_string_ref_t cas_fs_root_id;
209201

include/swift/DependencyScan/SerializedModuleDependencyCacheFormat.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ using llvm::BCVBR;
3939

4040
/// Every .moddepcache file begins with these 4 bytes, for easy identification.
4141
const unsigned char MODULE_DEPENDENCY_CACHE_FORMAT_SIGNATURE[] = {'I', 'M', 'D','C'};
42-
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR = 8;
42+
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR = 9;
4343
/// Increment this on every change.
4444
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MINOR = 0;
4545

@@ -203,7 +203,6 @@ using SwiftInterfaceModuleDetailsLayout =
203203
FileIDField, // swiftInterfaceFile
204204
FileIDArrayIDField, // compiledModuleCandidates
205205
FlagIDArrayIDField, // buildCommandLine
206-
FlagIDArrayIDField, // extraPCMArgs
207206
ContextHashIDField, // contextHash
208207
IsFrameworkField, // isFramework
209208
IsStaticField, // isStatic
@@ -219,7 +218,6 @@ using SwiftInterfaceModuleDetailsLayout =
219218

220219
using SwiftSourceModuleDetailsLayout =
221220
BCRecordLayout<SWIFT_SOURCE_MODULE_DETAILS_NODE, // ID
222-
FlagIDArrayIDField, // extraPCMArgs
223221
FileIDField, // bridgingHeaderFile
224222
FileIDArrayIDField, // sourceFiles
225223
FileIDArrayIDField, // bridgingSourceFiles
@@ -260,7 +258,6 @@ using ClangModuleDetailsLayout =
260258
ContextHashIDField, // contextHash
261259
FlagIDArrayIDField, // commandLine
262260
FileIDArrayIDField, // fileDependencies
263-
FlagIDArrayIDField, // capturedPCMArgs
264261
IdentifierIDField, // CASFileSystemRootID
265262
IdentifierIDField, // clangIncludeTreeRoot
266263
IdentifierIDField, // moduleCacheKey

include/swift/Frontend/ModuleInterfaceLoader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ struct InterfaceSubContextDelegateImpl: InterfaceSubContextDelegate {
690690
StringRef outputPath,
691691
SourceLoc diagLoc,
692692
llvm::function_ref<std::error_code(ASTContext&, ModuleDecl*,
693-
ArrayRef<StringRef>, ArrayRef<StringRef>,
693+
ArrayRef<StringRef>,
694694
StringRef, StringRef)> action) override;
695695
std::error_code runInSubCompilerInstance(StringRef moduleName,
696696
StringRef interfacePath,

lib/ClangImporter/ClangModuleDependencyScanner.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,6 @@ ModuleDependencyVector ClangImporter::bridgeClangModuleDependencies(
147147
return path.str();
148148
};
149149

150-
// This scanner invocation's already-captured APINotes version
151-
std::vector<std::string>
152-
capturedPCMArgs = {
153-
"-Xcc",
154-
("-fapinotes-swift-version=" +
155-
ctx.LangOpts.EffectiveLanguageVersion.asAPINotesVersionString())};
156-
157150
for (auto &clangModuleDep : clangDependencies) {
158151
// File dependencies for this module.
159152
std::vector<std::string> fileDeps;
@@ -281,7 +274,7 @@ ModuleDependencyVector ClangImporter::bridgeClangModuleDependencies(
281274
llvm::StringSet<> alreadyAddedModules;
282275
auto dependencies = ModuleDependencyInfo::forClangModule(
283276
pcmPath, mappedPCMPath, clangModuleDep.ClangModuleMapFile,
284-
clangModuleDep.ID.ContextHash, swiftArgs, fileDeps, capturedPCMArgs,
277+
clangModuleDep.ID.ContextHash, swiftArgs, fileDeps,
285278
LinkLibraries, RootID, IncludeTree, /*module-cache-key*/ "",
286279
clangModuleDep.IsSystem);
287280

0 commit comments

Comments
 (0)