mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #82939 from artemcm/62_DepScanExplicitInput
[6.2 🍒][Dependency Scanning] Consider `-swift-module-file` inputs when looking for dependencies
This commit is contained in:
@@ -213,6 +213,9 @@ ERROR(error_stdlib_module_name,none,
|
||||
"module name \"%0\" is reserved for the standard library"
|
||||
"%select{|; use -module-name flag to specify an alternate name}1",
|
||||
(StringRef, bool))
|
||||
WARNING(warn_multiple_module_inputs_same_name,none,
|
||||
"multiple Swift module file inputs with identifier \"%0\": replacing '%1' with '%2'",
|
||||
(StringRef, StringRef, StringRef))
|
||||
|
||||
ERROR(error_bad_export_as_name,none,
|
||||
"export-as name \"%0\" is not a valid identifier",
|
||||
|
||||
@@ -375,6 +375,7 @@ public:
|
||||
StringRef moduleOutputPath, StringRef sdkModuleOutputPath,
|
||||
const llvm::DenseSet<clang::tooling::dependencies::ModuleID> &alreadySeenClangModules,
|
||||
const std::vector<std::string> &swiftModuleClangCC1CommandLineArgs,
|
||||
const llvm::StringMap<std::string> &explicitSwiftModuleInputs,
|
||||
InterfaceSubContextDelegate &delegate,
|
||||
llvm::PrefixMapper *mapper = nullptr,
|
||||
bool isTestableImport = false) = 0;
|
||||
|
||||
@@ -519,7 +519,7 @@ public:
|
||||
|
||||
/// Module inputs specified with -swift-module-input,
|
||||
/// <ModuleName, Path to .swiftmodule file>
|
||||
std::vector<std::pair<std::string, std::string>> ExplicitSwiftModuleInputs;
|
||||
llvm::StringMap<std::string> ExplicitSwiftModuleInputs;
|
||||
|
||||
/// A map of placeholder Swift module dependency information.
|
||||
std::string PlaceholderDependencyModuleMap;
|
||||
|
||||
@@ -508,6 +508,7 @@ public:
|
||||
getModuleDependencies(Identifier moduleName, StringRef moduleOutputPath, StringRef sdkModuleOutputPath,
|
||||
const llvm::DenseSet<clang::tooling::dependencies::ModuleID> &alreadySeenClangModules,
|
||||
const std::vector<std::string> &swiftModuleClangCC1CommandLineArgs,
|
||||
const llvm::StringMap<std::string> &explicitSwiftModuleInputs,
|
||||
InterfaceSubContextDelegate &delegate,
|
||||
llvm::PrefixMapper *mapper,
|
||||
bool isTestableImport = false) override;
|
||||
|
||||
@@ -101,6 +101,9 @@ private:
|
||||
std::vector<std::string> swiftModuleClangCC1CommandLineArgs;
|
||||
// Working directory for clang module lookup queries
|
||||
std::string clangScanningWorkingDirectoryPath;
|
||||
|
||||
/// Module inputs specified with -swift-module-input,
|
||||
llvm::StringMap<std::string> explicitSwiftModuleInputs;
|
||||
|
||||
// CAS instance.
|
||||
std::shared_ptr<llvm::cas::ObjectStore> CAS;
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
create(ASTContext &ctx,
|
||||
DependencyTracker *tracker, ModuleLoadingMode loadMode,
|
||||
StringRef ExplicitSwiftModuleMap,
|
||||
const std::vector<std::pair<std::string, std::string>> &ExplicitSwiftModuleInputs,
|
||||
const llvm::StringMap<std::string> &ExplicitSwiftModuleInputs,
|
||||
bool IgnoreSwiftSourceInfoFile);
|
||||
|
||||
/// Append visible module names to \p names. Note that names are possibly
|
||||
@@ -224,8 +224,7 @@ public:
|
||||
create(ASTContext &ctx, llvm::cas::ObjectStore &CAS,
|
||||
llvm::cas::ActionCache &cache, DependencyTracker *tracker,
|
||||
ModuleLoadingMode loadMode, StringRef ExplicitSwiftModuleMap,
|
||||
const std::vector<std::pair<std::string, std::string>>
|
||||
&ExplicitSwiftModuleInputs,
|
||||
const llvm::StringMap<std::string> &ExplicitSwiftModuleInputs,
|
||||
bool IgnoreSwiftSourceInfoFile);
|
||||
|
||||
/// Append visible module names to \p names. Note that names are possibly
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
getModuleDependencies(Identifier moduleName, StringRef moduleOutputPath, StringRef sdkModuleOutputPath,
|
||||
const llvm::DenseSet<clang::tooling::dependencies::ModuleID> &alreadySeenClangModules,
|
||||
const std::vector<std::string> &swiftModuleClangCC1CommandLineArgs,
|
||||
const llvm::StringMap<std::string> &explicitSwiftModuleInputs,
|
||||
InterfaceSubContextDelegate &delegate,
|
||||
llvm::PrefixMapper *mapper,
|
||||
bool isTestableImport) override;
|
||||
|
||||
@@ -46,6 +46,8 @@ private:
|
||||
/// Clang-specific (-Xcc) command-line flags to include on
|
||||
/// Swift module compilation commands
|
||||
std::vector<std::string> swiftModuleClangCC1CommandLineArgs;
|
||||
/// Module inputs specified with -swift-module-input
|
||||
llvm::StringMap<std::string> explicitSwiftModuleInputs;
|
||||
|
||||
public:
|
||||
std::optional<ModuleDependencyInfo> dependencies;
|
||||
@@ -55,13 +57,15 @@ public:
|
||||
InterfaceSubContextDelegate &astDelegate,
|
||||
StringRef moduleOutputPath, StringRef sdkModuleOutputPath,
|
||||
std::vector<std::string> swiftModuleClangCC1CommandLineArgs,
|
||||
llvm::StringMap<std::string> explicitSwiftModuleInputs,
|
||||
ScannerKind kind = MDS_plain)
|
||||
: SerializedModuleLoaderBase(ctx, nullptr, LoadMode,
|
||||
/*IgnoreSwiftSourceInfoFile=*/true),
|
||||
kind(kind), moduleName(moduleName), astDelegate(astDelegate),
|
||||
moduleOutputPath(moduleOutputPath),
|
||||
sdkModuleOutputPath(sdkModuleOutputPath),
|
||||
swiftModuleClangCC1CommandLineArgs(swiftModuleClangCC1CommandLineArgs) {}
|
||||
swiftModuleClangCC1CommandLineArgs(swiftModuleClangCC1CommandLineArgs),
|
||||
explicitSwiftModuleInputs(explicitSwiftModuleInputs) {}
|
||||
|
||||
std::error_code findModuleFilesInDirectory(
|
||||
ImportPath::Element ModuleID, const SerializedModuleBaseName &BaseName,
|
||||
@@ -73,6 +77,10 @@ public:
|
||||
bool SkipBuildingInterface, bool IsFramework,
|
||||
bool IsTestableDependencyLookup) override;
|
||||
|
||||
bool canImportModule(ImportPath::Module named, SourceLoc loc,
|
||||
ModuleVersionInfo *versionInfo,
|
||||
bool isTestableImport) override;
|
||||
|
||||
virtual void collectVisibleTopLevelModuleNames(
|
||||
SmallVectorImpl<Identifier> &names) const override {
|
||||
llvm_unreachable("Not used");
|
||||
@@ -105,7 +113,7 @@ public:
|
||||
StringRef moduleOutputPath,
|
||||
StringRef sdkModuleOutputPath)
|
||||
: SwiftModuleScanner(ctx, LoadMode, moduleName, astDelegate,
|
||||
moduleOutputPath, sdkModuleOutputPath, {},
|
||||
moduleOutputPath, sdkModuleOutputPath, {}, {},
|
||||
MDS_placeholder) {
|
||||
// FIXME: Find a better place for this map to live, to avoid
|
||||
// doing the parsing on every module.
|
||||
|
||||
@@ -266,6 +266,7 @@ public:
|
||||
getModuleDependencies(Identifier moduleName, StringRef moduleOutputPath, StringRef sdkModuleOutputPath,
|
||||
const llvm::DenseSet<clang::tooling::dependencies::ModuleID> &alreadySeenClangModules,
|
||||
const std::vector<std::string> &swiftModuleClangCC1CommandLineArgs,
|
||||
const llvm::StringMap<std::string> &explicitSwiftModuleInputs,
|
||||
InterfaceSubContextDelegate &delegate,
|
||||
llvm::PrefixMapper *mapper,
|
||||
bool isTestableImport) override;
|
||||
|
||||
Reference in New Issue
Block a user