mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Driver][Frontend] -nostdimport and -nostdlibimport should remove the default framework search paths
-nostdimport and -nostdlibimport only remove the toolchain and usr/lib/swift search paths, and they leave the framework search paths intact. That makes it impossible to get a fully custom SDK environment. Make their behavior match clang's -nostdinc/-nostdlibinc behavior: treat framework and non-framework paths the same. In other words, -nostdinc removes *all* compiler provided search paths, and -nostdlibinc removes *all* SDK search paths. Rename SkipRuntimeLibraryImportPaths to SkipAllImportPaths, and ExcludeSDKPathsFromRuntimeLibraryImportPaths to SkipSDKImportPaths to reflect their updated behavior. Move the DarwinImplicitFrameworkSearchPaths handling from SearchPathOptions to CompilerInvocation, where RuntimeLibraryImportPaths is managed. Rename it to just ImplicitFrameworkSearchPaths, and filter for Darwin when it's set up so that all of the clients don't have to do Darwin filtering themselves later. rdar://150557632
This commit is contained in:
@@ -108,14 +108,11 @@ std::optional<bool> forEachModuleSearchPath(
|
||||
callback(path.Path, ModuleSearchPathKind::Framework, path.IsSystem))
|
||||
return result;
|
||||
|
||||
// Apple platforms have extra implicit framework search paths:
|
||||
// $SDKROOT/System/Library/Frameworks/ and $SDKROOT/Library/Frameworks/.
|
||||
if (Ctx.LangOpts.Target.isOSDarwin()) {
|
||||
for (const auto &path : Ctx.getDarwinImplicitFrameworkSearchPaths())
|
||||
if (auto result =
|
||||
callback(path, ModuleSearchPathKind::DarwinImplicitFramework,
|
||||
/*isSystem=*/true))
|
||||
return result;
|
||||
for (const auto &path :
|
||||
Ctx.SearchPathOpts.getImplicitFrameworkSearchPaths()) {
|
||||
if (auto result = callback(path, ModuleSearchPathKind::ImplicitFramework,
|
||||
/*isSystem=*/true))
|
||||
return result;
|
||||
}
|
||||
|
||||
for (const auto &importPath :
|
||||
@@ -240,7 +237,7 @@ void SerializedModuleLoaderBase::collectVisibleTopLevelModuleNamesImpl(
|
||||
return std::nullopt;
|
||||
}
|
||||
case ModuleSearchPathKind::Framework:
|
||||
case ModuleSearchPathKind::DarwinImplicitFramework: {
|
||||
case ModuleSearchPathKind::ImplicitFramework: {
|
||||
// Look for:
|
||||
// $PATH/{name}.framework/Modules/{name}.swiftmodule/{arch}.{extension}
|
||||
forEachDirectoryEntryPath(searchPath, [&](StringRef path) {
|
||||
@@ -964,7 +961,7 @@ bool SerializedModuleLoaderBase::findModule(
|
||||
continue;
|
||||
}
|
||||
case ModuleSearchPathKind::Framework:
|
||||
case ModuleSearchPathKind::DarwinImplicitFramework: {
|
||||
case ModuleSearchPathKind::ImplicitFramework: {
|
||||
isFramework = true;
|
||||
llvm::sys::path::append(currPath, moduleName + ".framework");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user