Skip to content

Commit

Permalink
[ClangImporter] Make sure the -resource-dir is checked before the `…
Browse files Browse the repository at this point in the history
…-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.
  • Loading branch information
finagolfin committed Aug 22, 2024
1 parent 993becc commit b7ec9c8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/ClangImporter/ClangIncludePaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ static std::optional<Path> getActualModuleMapPath(

Path result;

StringRef SDKPath = Opts.getSDKPath();
if (!SDKPath.empty()) {
result.append(SDKPath.begin(), SDKPath.end());
llvm::sys::path::append(result, "usr", "lib", "swift");
if (!Opts.RuntimeResourcePath.empty()) {
result.append(Opts.RuntimeResourcePath.begin(),
Opts.RuntimeResourcePath.end());
llvm::sys::path::append(result, platform);
if (isArchSpecific) {
llvm::sys::path::append(result, arch);
Expand All @@ -52,10 +51,11 @@ static std::optional<Path> getActualModuleMapPath(
return result;
}

if (!Opts.RuntimeResourcePath.empty()) {
StringRef SDKPath = Opts.getSDKPath();
if (!SDKPath.empty()) {
result.clear();
result.append(Opts.RuntimeResourcePath.begin(),
Opts.RuntimeResourcePath.end());
result.append(SDKPath.begin(), SDKPath.end());
llvm::sys::path::append(result, "usr", "lib", "swift");
llvm::sys::path::append(result, platform);
if (isArchSpecific) {
llvm::sys::path::append(result, arch);
Expand Down

0 comments on commit b7ec9c8

Please sign in to comment.