forked from OSchip/llvm-project
44a40046c8
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 |
||
---|---|---|
.. | ||
Inputs | ||
auto-detect-from-source-parent-of-cwd.cpp | ||
auto-detect-from-source-parent.cpp | ||
auto-detect-from-source.cpp | ||
clang-check-analyzer.cpp | ||
clang-check-args.cpp | ||
clang-check-ast-dump.cpp | ||
clang-check-autodetect-dir.cpp | ||
clang-check-builtin-headers.cpp | ||
clang-check-chdir.cpp | ||
clang-check-extra-arg.cpp | ||
clang-check-mac-libcxx-abspath.cpp | ||
clang-check-mac-libcxx-relpath.cpp | ||
clang-check-pwd.cpp | ||
clang-check-rel-path.cpp | ||
clang-check-strip-o.cpp | ||
clang-check.cpp | ||
clang-diff-args.test | ||
clang-diff-ast.cpp | ||
clang-diff-basic.cpp | ||
clang-diff-bottomup.cpp | ||
clang-diff-html.test | ||
clang-diff-json.cpp | ||
clang-diff-opt.cpp | ||
clang-diff-topdown.cpp | ||
fixed-database.cpp | ||
lit.local.cfg | ||
ms-asm-no-target.cpp | ||
multi-jobs.cpp | ||
pch.cpp |