[6.2.1][cherrypick] Plumb native-clang-tools-path to build support. #83778
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ensures the native-clang-tools-path option works correctly with the build support modules.
The build support Python libraries assume by default that if we do not supply a Swift toolchain path, we can find clang in the installed toolchain path: i.e., the clang that we just built. However, possibly during bootstrap, we may not have a preexisting Swift compiler but still want to use the clang on the platform that is already installed.
build-script already gives us native-clang-tools-path. Here, we plumb this through to the relevant Python modules. If the native-clang-tools-path is not specified, we use the install_toolchain_path, just like native_toolchain_path, and the existing behavior is effectively unchanged. If we do specify a native-clang-tools-path, then we return it to ensure that we properly refer to the clang that lives there instead of always defaulting to the just-built clang.
(This is the same as #82768, applied to
release/6.2.1
.)Changes are limited to the build system only, and as mentioned, if native-clang-tools-path is not specified, the behavior is unchanged.
Of relevance to the OpenBSD port in #78437, since we likely do not want to use the just-built LLVM tools like clang as part of the installation.
#81587
Minimal, only potentially affects seldom-used flag.
Has passed CI.
@justice-adams-apple