Files
swift-mirror/test/Frontend/default-search-paths.swift
Ian Anderson 44b2c08a5a [6.2][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
2025-05-23 22:12:45 -07:00

44 lines
3.0 KiB
Swift

// UNSUPPORTED: OS=windows-msvc
// Standard Apple paths.
// RUN: %swift_frontend_plain -target arm64-apple-macos15.4 %clang-importer-sdk-nosource -parse-stdlib -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=APPLE %s
// APPLE: Implicit framework search paths:
// APPLE-NEXT: [0] SOURCE_DIR/test/Inputs/clang-importer-sdk/System/Library/Frameworks
// APPLE-NEXT: [1] SOURCE_DIR/test/Inputs/clang-importer-sdk/System/Library/SubFrameworks
// APPLE-NEXT: [2] SOURCE_DIR/test/Inputs/clang-importer-sdk/Library/Frameworks
// APPLE-NEXT: Runtime library import search paths:
// APPLE-NEXT: [0] BUILD_DIR/lib/swift/macosx
// APPLE-NEXT: [1] SOURCE_DIR/test/Inputs/clang-importer-sdk/usr/lib/swift
// APPLE-NEXT: (End of search path lists.)
// Non-Apple platforms don't have any implicit framework search paths.
// RUN: %swift_frontend_plain -target x86_64-unknown-linux-android %clang-importer-sdk-nosource -parse-stdlib -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=ANDROID %s
// ANDROID: Implicit framework search paths:
// ANDROID-NEXT: Runtime library import search paths:
// ANDROID-NEXT: [0] BUILD_DIR/lib/swift/android
// ANDROID-NEXT: [1] BUILD_DIR/lib/swift/android/x86_64
// ANDROID-NEXT: [2] SOURCE_DIR/test/Inputs/clang-importer-sdk/usr/lib/swift/android
// ANDROID-NEXT: [3] SOURCE_DIR/test/Inputs/clang-importer-sdk/usr/lib/swift/android/x86_64
// ANDROID-NEXT: (End of search path lists.)
// -nostdimport doesn't set up any standard import paths at all.
// RUN: %swift_frontend_plain -target arm64-apple-macos15.4 %clang-importer-sdk-nosource -parse-stdlib -nostdimport -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=NOSTDIMPORT %s
// RUN: %swift_frontend_plain -target x86_64-unknown-linux-android %clang-importer-sdk-nosource -parse-stdlib -nostdimport -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=NOSTDIMPORT %s
// NOSTDIMPORT: Implicit framework search paths:
// NOSTDIMPORT-NEXT: Runtime library import search paths:
// NOSTDIMPORT-NEXT: (End of search path lists.)
// -nostdlibimport removes all of the standard imports from the SDK but leaves the toolchain ones.
// RUN: %swift_frontend_plain -target arm64-apple-macos15.4 %clang-importer-sdk-nosource -parse-stdlib -nostdlibimport -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=APPLE-NOSTDLIBIMPORT %s
// APPLE-NOSTDLIBIMPORT: Implicit framework search paths:
// APPLE-NOSTDLIBIMPORT-NEXT: Runtime library import search paths:
// APPLE-NOSTDLIBIMPORT-NEXT: [0] BUILD_DIR/lib/swift/macosx
// APPLE-NOSTDLIBIMPORT-NEXT: (End of search path lists.)
// RUN: %swift_frontend_plain -target x86_64-unknown-linux-android %clang-importer-sdk-nosource -parse-stdlib -nostdlibimport -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=ANDROID-NOSTDLIBIMPORT %s
// ANDROID-NOSTDLIBIMPORT: Implicit framework search paths:
// ANDROID-NOSTDLIBIMPORT-NEXT: Runtime library import search paths:
// ANDROID-NOSTDLIBIMPORT-NEXT: [0] BUILD_DIR/lib/swift/android
// ANDROID-NOSTDLIBIMPORT-NEXT: [1] BUILD_DIR/lib/swift/android/x86_64
// ANDROID-NOSTDLIBIMPORT-NEXT: (End of search path lists.)