1. Add support to find out resource dir and add it as compilation args (details)
Commit 26fa9e31f58a7ff693f3a5d8c2eb1b6a5a13b133 by kousikk
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:
The file was modifiedclang/tools/clang-scan-deps/ClangScanDeps.cpp