llvm-project/clang/tools
Kousik Kumar 26fa9e31f5 Add support to find out resource dir and add it as compilation args
Summary:
If -resource-dir is not specified as part of the compilation command, then by default
clang-scan-deps picks up a directory relative to its own path as resource-directory.
This is probably not the right behavior - since resource directory should be picked relative
to the path of the clang-compiler in the compilation command.
This patch adds support for it along with a cache to store the resource-dir paths based on
compiler paths.

Notes:
1. "-resource-dir" is a behavior that's specific to clang, gcc does not have that flag. That's why if I'm not able to find a resource-dir, I quietly ignore it.
2. Should I also use the mtime of the compiler in the cache? I think its not strictly necessary since we assume the filesystem is immutable.
3. From my testing, this does not regress performance.
4. Will try to get this tested on Windows.

But basically the problem that this patch is trying to solve is, clients might not always want to specify
"-resource-dir" in their compile commands, so scan-deps must auto-infer it correctly.

Reviewers: arphaman, Bigcheese, jkorous, dexonsmith, klimek

Reviewed By: Bigcheese

Subscribers: MaskRay, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69122
2019-11-22 07:43:54 -08:00
..
arcmt-test ArrayRef'ized CompilerInvocation::CreateFromArgs 2019-08-27 22:13:31 +00:00
c-arcmt-test [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
c-index-test [clang][Index] Replace CodegenNameGenerator with ASTNameGenerator 2019-09-05 20:33:52 +00:00
clang-check [clang] [cmake] Use add_clang_tool() to install all tools 2019-10-04 20:28:59 +00:00
clang-diff [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00
clang-extdef-mapping [clang] [cmake] Use add_clang_tool() to install all tools 2019-10-04 20:28:59 +00:00
clang-format [clang-format] refactor the use of the SMDiagnostics in replacement warnings 2019-11-13 20:55:44 +00:00
clang-format-vs clang-format extension: Widen the supported versions range 2019-06-13 07:07:24 +00:00
clang-fuzzer [clang-fuzzer] Update proto fuzzer example for r375453. 2019-10-22 07:51:37 +00:00
clang-import-test [clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSource 2019-10-01 09:02:05 +00:00
clang-offload-bundler Reland "[Clang][Bundler] Error reporting improvements" 2019-10-25 19:00:06 -07:00
clang-offload-wrapper [Clang][OpenMP Offload] Move offload registration code to the wrapper 2019-10-15 18:42:47 +00:00
clang-refactor [clang][NFC] Make various uses of Regex const 2019-11-19 16:15:21 +00:00
clang-rename Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
clang-scan-deps Add support to find out resource dir and add it as compilation args 2019-11-22 07:43:54 -08:00
clang-shlib [CMake] Clang: Don't use object libraries with Xcode 2019-10-04 18:17:58 +00:00
diag-build
diagtool [diagtool] Use `operator<<(Colors)` to print out colored output. 2019-08-08 07:04:01 +00:00
driver [NFC] Add SUPPORT_PLUGINS to add_llvm_executable() 2019-11-06 14:32:35 -05:00
libclang [NFC] Refactor representation of materialized temporaries 2019-11-19 18:20:45 +01:00
scan-build [clang] [cmake] Add distribution install targets for remaining components 2019-10-04 05:43:20 +00:00
scan-build-py [tools] Fix python DeprecationWarning: invalid escape sequence 2019-02-11 15:03:17 +00:00
scan-view [clang] [cmake] Add distribution install targets for remaining components 2019-10-04 05:43:20 +00:00
CMakeLists.txt [Clang][OpenMP Offload] Add new tool for wrapping offload device binaries 2019-10-09 20:42:58 +00:00