diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index a69ab5259fef4..85a3085a60fc9 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -328,7 +328,7 @@ def F_EQ : Joined<["-"], "F=">, Flags<[FrontendOption, ArgumentIsPath]>, def Fsystem : Separate<["-"], "Fsystem">, Flags<[FrontendOption, ArgumentIsPath, SwiftSymbolGraphExtractOption, - SwiftSynthesizeInterfaceOption]>, + SwiftAPIDigesterOption, SwiftSynthesizeInterfaceOption]>, HelpText<"Add directory to system framework search path">; def I : JoinedOrSeparate<["-"], "I">, @@ -340,7 +340,7 @@ def I_EQ : Joined<["-"], "I=">, Flags<[FrontendOption, ArgumentIsPath]>, def Isystem : Separate<["-"], "Isystem">, Flags<[FrontendOption, ArgumentIsPath, SwiftSymbolGraphExtractOption, - SwiftSynthesizeInterfaceOption]>, + SwiftAPIDigesterOption, SwiftSynthesizeInterfaceOption]>, HelpText<"Add directory to the system import search path">; def import_underlying_module : Flag<["-"], "import-underlying-module">, diff --git a/lib/DriverTool/swift_api_digester_main.cpp b/lib/DriverTool/swift_api_digester_main.cpp index e90269541f93b..ed5b48c33a8c2 100644 --- a/lib/DriverTool/swift_api_digester_main.cpp +++ b/lib/DriverTool/swift_api_digester_main.cpp @@ -38,6 +38,7 @@ #include "swift/Option/Options.h" #include "swift/Parse/ParseVersion.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/VirtualOutputBackends.h" #include "llvm/Support/raw_ostream.h" #include @@ -2261,11 +2262,12 @@ class SwiftAPIDigesterInvocation { std::string BaselineSDK; std::string Triple; std::string SwiftVersion; - std::vector CCSystemFrameworkPaths; + std::vector SystemFrameworkPaths; std::vector BaselineFrameworkPaths; std::vector FrameworkPaths; - std::vector BaselineModuleInputPaths; - std::vector ModuleInputPaths; + std::vector SystemModuleImportPaths; + std::vector BaselineModuleImportPaths; + std::vector ModuleImportPaths; std::string ModuleList; std::vector ModuleNames; std::vector PreferInterfaceForModules; @@ -2362,11 +2364,13 @@ class SwiftAPIDigesterInvocation { BaselineSDK = ParsedArgs.getLastArgValue(OPT_bsdk).str(); Triple = ParsedArgs.getLastArgValue(OPT_target).str(); SwiftVersion = ParsedArgs.getLastArgValue(OPT_swift_version).str(); - CCSystemFrameworkPaths = ParsedArgs.getAllArgValues(OPT_iframework); + SystemFrameworkPaths = ParsedArgs.getAllArgValues(OPT_Fsystem); + llvm::append_range(SystemFrameworkPaths, ParsedArgs.getAllArgValues(OPT_iframework)); BaselineFrameworkPaths = ParsedArgs.getAllArgValues(OPT_BF); FrameworkPaths = ParsedArgs.getAllArgValues(OPT_F); - BaselineModuleInputPaths = ParsedArgs.getAllArgValues(OPT_BI); - ModuleInputPaths = ParsedArgs.getAllArgValues(OPT_I); + SystemModuleImportPaths = ParsedArgs.getAllArgValues(OPT_Isystem); + BaselineModuleImportPaths = ParsedArgs.getAllArgValues(OPT_BI); + ModuleImportPaths = ParsedArgs.getAllArgValues(OPT_I); ModuleList = ParsedArgs.getLastArgValue(OPT_module_list_file).str(); ModuleNames = ParsedArgs.getAllArgValues(OPT_module); PreferInterfaceForModules = @@ -2421,7 +2425,7 @@ class SwiftAPIDigesterInvocation { } bool hasBaselineInput() { - return !BaselineModuleInputPaths.empty() || + return !BaselineModuleImportPaths.empty() || !BaselineFrameworkPaths.empty() || !BaselineSDK.empty(); } @@ -2476,29 +2480,30 @@ class SwiftAPIDigesterInvocation { InitInvoke.setRuntimeResourcePath(ResourceDir); } std::vector FramePaths; - for (const auto &path : CCSystemFrameworkPaths) { + for (const auto &path : SystemFrameworkPaths) { FramePaths.push_back({path, /*isSystem=*/true}); } + std::vector ImportPaths; + for (const auto &path : SystemModuleImportPaths) { + ImportPaths.push_back({path, /*isSystem=*/true}); + } if (IsBaseline) { for (const auto &path : BaselineFrameworkPaths) { FramePaths.push_back({path, /*isSystem=*/false}); } - std::vector ImportPaths; - for (const auto &path : BaselineModuleInputPaths) { + for (const auto &path : BaselineModuleImportPaths) { ImportPaths.push_back({path, /*isSystem=*/false}); } - InitInvoke.setImportSearchPaths(ImportPaths); } else { for (const auto &path : FrameworkPaths) { FramePaths.push_back({path, /*isSystem=*/false}); } - std::vector ImportPaths; - for (const auto &path : ModuleInputPaths) { + for (const auto &path : ModuleImportPaths) { ImportPaths.push_back({path, /*isSystem=*/false}); } - InitInvoke.setImportSearchPaths(ImportPaths); } InitInvoke.setFrameworkSearchPaths(FramePaths); + InitInvoke.setImportSearchPaths(ImportPaths); if (!ModuleList.empty()) { if (readFileLineByLine(ModuleList, Modules)) exit(1); diff --git a/utils/api_checker/swift-api-checker.py b/utils/api_checker/swift-api-checker.py index 9ec87c088f306..c1941eb82a971 100755 --- a/utils/api_checker/swift-api-checker.py +++ b/utils/api_checker/swift-api-checker.py @@ -146,7 +146,7 @@ def run(self, output, module, swift_ver, opts, '/tmp/ModuleCache', '-swift-version', swift_ver, '-abort-on-module-fail'] for path in self.frameworks: - cmd.extend(['-iframework', path]) + cmd.extend(['-Fsystem', path]) for path in self.inputs: cmd.extend(['-I', path]) if self.abi: