Skip to content

Commit 7c3eaf4

Browse files
Merge pull request #81760 from ian-twilightcoder/nostdimport-tweaks
[Frontend][test] Minor changes from "-nostdimport and -nostdlibimport should remove the default framework search paths"
2 parents a7a9b0a + 1197e2e commit 7c3eaf4

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ updateImplicitFrameworkSearchPaths(SearchPathOptions &SearchPathOpts,
312312
if (LangOpts.Target.isOSDarwin()) {
313313
if (!SearchPathOpts.SkipSDKImportPaths &&
314314
!SearchPathOpts.getSDKPath().empty()) {
315-
StringRef SDKPath = SearchPathOpts.getSDKPath();
315+
SmallString<128> SDKPath(SearchPathOpts.getSDKPath());
316+
316317
SmallString<128> systemFrameworksScratch(SDKPath);
317318
llvm::sys::path::append(systemFrameworksScratch, "System", "Library",
318319
"Frameworks");
@@ -321,6 +322,7 @@ updateImplicitFrameworkSearchPaths(SearchPathOptions &SearchPathOpts,
321322
"SubFrameworks");
322323
SmallString<128> frameworksScratch(SDKPath);
323324
llvm::sys::path::append(frameworksScratch, "Library", "Frameworks");
325+
324326
ImplicitFrameworkSearchPaths = {systemFrameworksScratch.str().str(),
325327
systemSubFrameworksScratch.str().str(),
326328
frameworksScratch.str().str()};

test/Frontend/default-search-paths.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// UNSUPPORTED: OS=windows-msvc
22

33
// Standard Apple paths.
4-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -target arm64-apple-macos15.4 -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=APPLE %s
4+
// 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
55
// APPLE: Implicit framework search paths:
66
// APPLE-NEXT: [0] SOURCE_DIR/test/Inputs/clang-importer-sdk/System/Library/Frameworks
77
// APPLE-NEXT: [1] SOURCE_DIR/test/Inputs/clang-importer-sdk/System/Library/SubFrameworks
@@ -12,7 +12,7 @@
1212
// APPLE-NEXT: (End of search path lists.)
1313

1414
// Non-Apple platforms don't have any implicit framework search paths.
15-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -target x86_64-unknown-linux-android -parse -parse-stdlib %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=ANDROID %s
15+
// 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
1616
// ANDROID: Implicit framework search paths:
1717
// ANDROID-NEXT: Runtime library import search paths:
1818
// ANDROID-NEXT: [0] BUILD_DIR/lib/swift/android
@@ -22,20 +22,20 @@
2222
// ANDROID-NEXT: (End of search path lists.)
2323

2424
// -nostdimport doesn't set up any standard import paths at all.
25-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -target arm64-apple-macos15.4 -nostdimport -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=NOSTDIMPORT %s
26-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -target x86_64-unknown-linux-android -nostdimport -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=NOSTDIMPORT %s
25+
// 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
26+
// 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
2727
// NOSTDIMPORT: Implicit framework search paths:
2828
// NOSTDIMPORT-NEXT: Runtime library import search paths:
2929
// NOSTDIMPORT-NEXT: (End of search path lists.)
3030

3131
// -nostdlibimport removes all of the standard imports from the SDK but leaves the toolchain ones.
32-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -target arm64-apple-macos15.4 -nostdlibimport -parse %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=APPLE-NOSTDLIBIMPORT %s
32+
// 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
3333
// APPLE-NOSTDLIBIMPORT: Implicit framework search paths:
3434
// APPLE-NOSTDLIBIMPORT-NEXT: Runtime library import search paths:
3535
// APPLE-NOSTDLIBIMPORT-NEXT: [0] BUILD_DIR/lib/swift/macosx
3636
// APPLE-NOSTDLIBIMPORT-NEXT: (End of search path lists.)
3737

38-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -target x86_64-unknown-linux-android -nostdlibimport -parse -parse-stdlib %s -Rmodule-loading 2>&1 | %FileCheck -check-prefix=ANDROID-NOSTDLIBIMPORT %s
38+
// 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
3939
// ANDROID-NOSTDLIBIMPORT: Implicit framework search paths:
4040
// ANDROID-NOSTDLIBIMPORT-NEXT: Runtime library import search paths:
4141
// ANDROID-NOSTDLIBIMPORT-NEXT: [0] BUILD_DIR/lib/swift/android

0 commit comments

Comments
 (0)