Skip to content

Commit f189a95

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 7268640 commit f189a95

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/ClangImporter/ClangIncludePaths.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ static std::optional<Path> getActualModuleMapPath(
3535

3636
Path result;
3737

38-
StringRef SDKPath = Opts.getSDKPath();
39-
if (!SDKPath.empty()) {
40-
result.append(SDKPath.begin(), SDKPath.end());
41-
llvm::sys::path::append(result, "usr", "lib", "swift");
38+
if (!Opts.RuntimeResourcePath.empty()) {
39+
result.clear();
40+
result.append(Opts.RuntimeResourcePath.begin(),
41+
Opts.RuntimeResourcePath.end());
4242
llvm::sys::path::append(result, platform);
4343
if (isArchSpecific) {
4444
llvm::sys::path::append(result, arch);
@@ -52,10 +52,10 @@ static std::optional<Path> getActualModuleMapPath(
5252
return result;
5353
}
5454

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

0 commit comments

Comments
 (0)