[Darwin toolchain] Tune the logic for finding arclite.
authorSteven Wu <stevenwu@apple.com>
Wed, 20 Jul 2022 23:45:09 +0000 (16:45 -0700)
committerSteven Wu <stevenwu@apple.com>
Wed, 20 Jul 2022 23:45:52 +0000 (16:45 -0700)
commitd0728260577d66b4b4d922adf0a40de86f09ccf5
treedfa3e3616216b65e16726979df30138289505bc2
parent4fbd1d6c872e8228f23a6e13914222af40ca6461
[Darwin toolchain] Tune the logic for finding arclite.

The heuristic used to determine where the arclite libraries are to be
found was based on the path of the `clang` executable. However, in some
scenarios the `clang` executable is within a toolchain that does not
have arclite. When this happens, derive the arclite paths from the
sysroot option.

This allows Clang to correctly derive the arclite directory in, e.g.,
Swift CI, using similar logic to what the Swift driver has been doing
for several years.

Patched by Doug Gregor.

Reviewed By: keith

Differential Revision: https://reviews.llvm.org/D130205
clang/lib/Driver/ToolChains/Darwin.cpp