llvm-project/clang/test/Tooling
Ilya Biryukov 44a40046c8 Move detection of libc++ include dirs to Driver on MacOS
Summary:
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.

Reviewers: JDevlieghere, arphaman, EricWF

Reviewed By: arphaman

Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D54630

llvm-svn: 348365
2018-12-05 14:24:14 +00:00
..
Inputs Move detection of libc++ include dirs to Driver on MacOS 2018-12-05 14:24:14 +00:00
auto-detect-from-source-parent-of-cwd.cpp
auto-detect-from-source-parent.cpp
auto-detect-from-source.cpp [Tooling] JSONCompilationDatabasePlugin infers compile commands for missing files 2018-09-14 12:24:09 +00:00
clang-check-analyzer.cpp [Tooling] Allow -flto flags and filter out -Wa, flags 2018-08-22 17:13:40 +00:00
clang-check-args.cpp
clang-check-ast-dump.cpp Compound literals, enums, et al require const expr 2018-11-09 00:41:36 +00:00
clang-check-autodetect-dir.cpp
clang-check-builtin-headers.cpp
clang-check-chdir.cpp
clang-check-extra-arg.cpp [clang] - Simplify tools::SplitDebugName. 2018-12-05 11:09:10 +00:00
clang-check-mac-libcxx-abspath.cpp Move detection of libc++ include dirs to Driver on MacOS 2018-12-05 14:24:14 +00:00
clang-check-mac-libcxx-relpath.cpp Move detection of libc++ include dirs to Driver on MacOS 2018-12-05 14:24:14 +00:00
clang-check-pwd.cpp
clang-check-rel-path.cpp
clang-check-strip-o.cpp
clang-check.cpp
clang-diff-args.test [clang-diff] Make printing of matches optional 2017-08-19 12:04:04 +00:00
clang-diff-ast.cpp [clang-diff] Treat CXXCtorInitializer as a node 2017-08-27 22:52:20 +00:00
clang-diff-basic.cpp [clang-diff] Use the relative name for NamedDecl 2017-08-22 08:56:26 +00:00
clang-diff-bottomup.cpp [clang-diff] Improve and test getNodeValue 2017-08-20 16:18:43 +00:00
clang-diff-html.test [clang-diff] Reformat test, NFC 2017-08-23 16:32:35 +00:00
clang-diff-json.cpp [lit, python] Always add quotes around the python path in lit 2018-08-06 22:37:45 +00:00
clang-diff-opt.cpp [clang-diff] Improve and test getNodeValue 2017-08-20 16:18:43 +00:00
clang-diff-topdown.cpp [clang-diff] Refactor stop-after command-line flag 2017-08-22 17:42:44 +00:00
fixed-database.cpp [tooling] Make compile_flags.txt negative test more hermetic 2017-11-14 15:22:34 +00:00
lit.local.cfg
ms-asm-no-target.cpp
multi-jobs.cpp
pch.cpp