Skip to content

Commit 9eeb78b

Browse files
authored
Merge pull request swiftlang#77719 from artemcm/RemoveBatchDependencyScan
[Dependency Scanning] Deprecate/Remove batch scanning capability
2 parents 24094c3 + 477ba0d commit 9eeb78b

34 files changed

+194
-1011
lines changed

include/swift-c/DependencyScan/DependencyScan.h

Lines changed: 58 additions & 67 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,47 +294,39 @@ 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

295-
//=== Batch Scan Input Functions ------------------------------------------===//
296-
297-
/// Create an \c swiftscan_batch_scan_input_t instance.
298-
/// The returned \c swiftscan_batch_scan_input_t is owned by the caller and must be disposed
299-
/// of using \c swiftscan_batch_scan_input_dispose .
300-
SWIFTSCAN_PUBLIC swiftscan_batch_scan_input_t *
301-
swiftscan_batch_scan_input_create();
302-
303-
SWIFTSCAN_PUBLIC void
304-
swiftscan_batch_scan_input_set_modules(swiftscan_batch_scan_input_t *input,
305-
int count,
306-
swiftscan_batch_scan_entry_t *modules);
307-
308-
//=== Batch Scan Entry Functions ------------------------------------------===//
309-
310-
/// Create an \c swiftscan_batch_scan_entry_t instance.
311-
/// The returned \c swiftscan_batch_scan_entry_t is owned by the caller and must be disposed
312-
/// of using \c swiftscan_batch_scan_entry_dispose .
313-
SWIFTSCAN_PUBLIC swiftscan_batch_scan_entry_t
314-
swiftscan_batch_scan_entry_create();
315-
316-
SWIFTSCAN_PUBLIC void
317-
swiftscan_batch_scan_entry_set_module_name(swiftscan_batch_scan_entry_t entry,
318-
const char *name);
319-
320-
SWIFTSCAN_PUBLIC void
321-
swiftscan_batch_scan_entry_set_arguments(swiftscan_batch_scan_entry_t entry,
322-
const char *arguments);
323-
324-
SWIFTSCAN_PUBLIC void
325-
swiftscan_batch_scan_entry_set_is_swift(swiftscan_batch_scan_entry_t entry,
326-
bool is_swift);
327-
328-
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
329-
swiftscan_batch_scan_entry_get_module_name(swiftscan_batch_scan_entry_t entry);
330-
331-
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
332-
swiftscan_batch_scan_entry_get_arguments(swiftscan_batch_scan_entry_t entry);
333-
334-
SWIFTSCAN_PUBLIC bool
335-
swiftscan_batch_scan_entry_get_is_swift(swiftscan_batch_scan_entry_t entry);
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);
336330

337331
//=== Prescan Result Functions --------------------------------------------===//
338332

@@ -382,15 +376,16 @@ swiftscan_dependency_graph_dispose(swiftscan_dependency_graph_t result);
382376
SWIFTSCAN_PUBLIC void
383377
swiftscan_import_set_dispose(swiftscan_import_set_t result);
384378

379+
/// Deprecated
385380
SWIFTSCAN_PUBLIC void
386381
swiftscan_batch_scan_entry_dispose(swiftscan_batch_scan_entry_t entry);
387-
382+
/// Deprecated
388383
SWIFTSCAN_PUBLIC void
389384
swiftscan_batch_scan_input_dispose(swiftscan_batch_scan_input_t *input);
390-
385+
/// Deprecated
391386
SWIFTSCAN_PUBLIC void
392387
swiftscan_batch_scan_result_dispose(swiftscan_batch_scan_result_t *result);
393-
388+
/// Deprecated
394389
SWIFTSCAN_PUBLIC void
395390
swiftscan_scan_invocation_dispose(swiftscan_scan_invocation_t invocation);
396391

@@ -427,22 +422,18 @@ SWIFTSCAN_PUBLIC void swiftscan_scanner_dispose(swiftscan_scanner_t);
427422
SWIFTSCAN_PUBLIC swiftscan_dependency_graph_t swiftscan_dependency_graph_create(
428423
swiftscan_scanner_t scanner, swiftscan_scan_invocation_t invocation);
429424

430-
/// Invoke the scan for an input batch of modules specified in the
431-
/// \c swiftscan_batch_scan_input_t argument. The returned
432-
/// \c swiftscan_batch_scan_result_t is owned by the caller and must be disposed
433-
/// of using \c swiftscan_batch_scan_result_dispose .
434-
SWIFTSCAN_PUBLIC swiftscan_batch_scan_result_t *
435-
swiftscan_batch_scan_result_create(swiftscan_scanner_t scanner,
436-
swiftscan_batch_scan_input_t *batch_input,
437-
swiftscan_scan_invocation_t invocation);
438-
439425
/// Invoke the import prescan using arguments specified in the \c
440426
/// swiftscan_scan_invocation_t argument. The returned \c swiftscan_import_set_t
441427
/// is owned by the caller and must be disposed of using \c
442428
/// swiftscan_import_set_dispose .
443429
SWIFTSCAN_PUBLIC swiftscan_import_set_t swiftscan_import_set_create(
444430
swiftscan_scanner_t scanner, swiftscan_scan_invocation_t invocation);
445431

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);
446437

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

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,10 @@ ERROR(placeholder_dependency_module_map_corrupted,none,
354354
"Swift placeholder dependency module map from %0 is malformed",
355355
(StringRef))
356356

357-
ERROR(batch_scan_input_file_missing,none,
358-
"cannot open batch dependencies scan input file from %0",
359-
(StringRef))
360-
361357
ERROR(const_extract_protocol_list_input_file_missing,none,
362358
"cannot open constant extraction protocol list input file from %0",
363359
(StringRef))
364360

365-
ERROR(batch_scan_input_file_corrupted,none,
366-
"batch dependencies scan input file from %0 is malformed",
367-
(StringRef))
368-
369361
ERROR(const_extract_protocol_list_input_file_corrupted,none,
370362
"constant extraction protocol list input file from %0 is malformed",
371363
(StringRef))

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/AST/SearchPathOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,6 @@ class SearchPathOptions {
530530
/// A map of placeholder Swift module dependency information.
531531
std::string PlaceholderDependencyModuleMap;
532532

533-
/// A file containing modules we should perform batch scanning.
534-
std::string BatchScanInputFilePath;
535-
536533
/// A file containing a list of protocols whose conformances require const value extraction.
537534
std::string ConstGatherProtocolListFilePath;
538535

0 commit comments

Comments
 (0)