Skip to content

Commit 965800f

Browse files
committed
[ClangImporter] Make sure the -resource-dir is checked before the -sdk, as done everywhere else in the compiler
Otherwise, these module maps can be pulled from a system SDK instead when building a fresh Swift stdlib, fixes #74696.
1 parent f8e35f0 commit 965800f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/ClangImporter/ClangIncludePaths.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ static std::optional<Path> getActualModuleMapPath(
3434

3535
Path result;
3636

37-
StringRef SDKPath = Opts.getSDKPath();
38-
if (!SDKPath.empty()) {
39-
result.append(SDKPath.begin(), SDKPath.end());
40-
llvm::sys::path::append(result, "usr", "lib", "swift");
37+
if (!Opts.RuntimeResourcePath.empty()) {
38+
result.append(Opts.RuntimeResourcePath.begin(),
39+
Opts.RuntimeResourcePath.end());
4140
llvm::sys::path::append(result, platform);
4241
if (isArchSpecific) {
4342
llvm::sys::path::append(result, arch);
@@ -51,10 +50,11 @@ static std::optional<Path> getActualModuleMapPath(
5150
return result;
5251
}
5352

54-
if (!Opts.RuntimeResourcePath.empty()) {
53+
StringRef SDKPath = Opts.getSDKPath();
54+
if (!SDKPath.empty()) {
5555
result.clear();
56-
result.append(Opts.RuntimeResourcePath.begin(),
57-
Opts.RuntimeResourcePath.end());
56+
result.append(SDKPath.begin(), SDKPath.end());
57+
llvm::sys::path::append(result, "usr", "lib", "swift");
5858
llvm::sys::path::append(result, platform);
5959
if (isArchSpecific) {
6060
llvm::sys::path::append(result, arch);

0 commit comments

Comments
 (0)