[PATCH] D54630: Move detection of libc++ include dirs to Driver on MacOS
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 16 05:47:01 PST 2018
ilya-biryukov created this revision.
ilya-biryukov added reviewers: JDevlieghere, arphaman.
Herald added a reviewer: EricWF.
Herald added subscribers: kadircet, christof, ioeric.
The intention is to make the tools replaying compilations from 'compile_commands.json'
(clang-tidy, clangd, etc.) find the same standard library as the original compiler
specified in 'compile_commands.json'.
Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied
on the value of resource dir as an approximation of the compiler install dir. The new logic
uses the actual compiler install dir and is performed in the driver. This is consistent with
the C++ standard library detection on other platforms and allows to override the resource dir
in the tools using the compile_commands.json without altering the
standard library detection mechanism. The tools have to override the resource dir to make sure
they use a consistent version of the builtin headers.
There is still logic in InitHeaderSearch that attemps to add the absolute includes for the
the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend
via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too,
but it could potentially break the library detection on other systems, so we don't tackle it in this
patch to keep its scope manageable.
This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675.
The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the
driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke
the libc++ detection in clang itself, which caused LLDB tests to break.
The LLDB tests pass with new fix.
Repository:
rC Clang
https://reviews.llvm.org/D54630
Files:
clang-tools-extra/test/clang-tidy/Inputs/mock-libcxx/include/c++/v1/mock_vector
clang-tools-extra/test/clang-tidy/clang-tidy-mac-libcxx.cpp
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Darwin.h
clang/lib/Frontend/InitHeaderSearch.cpp
clang/test/Driver/darwin-stdlib.cpp
clang/test/Tooling/Inputs/mock-libcxx/include/c++/v1/mock_vector
clang/test/Tooling/clang-check-mac-libcxx-abspath.cpp
clang/test/Tooling/clang-check-mac-libcxx-relpath.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54630.174358.patch
Type: text/x-patch
Size: 10090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181116/6984a27f/attachment-0001.bin>
More information about the cfe-commits
mailing list