Move detection of libc++ include dirs to Driver on MacOSSummary:The intention is to make the tools replaying compilations from 'compile_commands.json'(clang-tidy, clangd, etc.) find the same stan
Move detection of libc++ include dirs to Driver on MacOSSummary: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 compilerspecified in 'compile_commands.json'.Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and reliedon the value of resource dir as an approximation of the compiler install dir. The new logicuses the actual compiler install dir and is performed in the driver. This is consistent withthe C++ standard library detection on other platforms and allows to override the resource dirin the tools using the compile_commands.json without altering thestandard library detection mechanism. The tools have to override the resource dir to make surethey use a consistent version of the builtin headers.There is still logic in InitHeaderSearch that attemps to add the absolute includes for thethe C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontendvia 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 thispatch 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 thedriver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it brokethe libc++ detection in clang itself, which caused LLDB tests to break.The LLDB tests pass with new fix.Reviewers: JDevlieghere, arphaman, EricWFReviewed By: arphamanSubscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commitsDifferential Revision: https://reviews.llvm.org/D54630llvm-svn: 348365
show more ...
Revert "Make clang-based tools find libc++ on MacOS"This breaks the LLDB bots.llvm-svn: 346675
Make clang-based tools find libc++ on MacOSSummary:When they read compiler args from compile_commands.json.This change allows to run clang-based tools, like clang-tidy or clangd,built from head
Make clang-based tools find libc++ on MacOSSummary:When they read compiler args from compile_commands.json.This change allows to run clang-based tools, like clang-tidy or clangd,built from head using the compile_commands.json file produced for XCodetoolchains.On MacOS clang can find the C++ standard library relative to thecompiler installation dir.The logic to do this was based on resource dir as an approximation ofwhere the compiler is installed. This broke the tools that read'compile_commands.json' and don't ship with the compiler, as theytypically change resource dir.To workaround this, we now use compiler install dir detected by the driverto better mimic the behavior of the original compiler when replaying thecompilations using other tools.Reviewers: sammccall, arphaman, EricWFReviewed By: sammccallSubscribers: ioeric, christof, kadircet, cfe-commitsDifferential Revision: https://reviews.llvm.org/D54310llvm-svn: 346652