diff options
author | Sam McCall <sam.mccall@gmail.com> | 2021-12-22 16:57:59 +0100 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2022-01-04 16:10:27 +0100 |
commit | 0683a1e588ade04bba2572e5ab6cf1361ed392d4 (patch) | |
tree | 50ee56f3861e0c88e8f61ba8131972b4fd17e59c /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 6c031780aa2c08996d1351de5e7541c75d6645c5 (diff) | |
download | llvm-0683a1e588ade04bba2572e5ab6cf1361ed392d4.zip llvm-0683a1e588ade04bba2572e5ab6cf1361ed392d4.tar.gz llvm-0683a1e588ade04bba2572e5ab6cf1361ed392d4.tar.bz2 |
[clangd] Adjust compile flags so they work when applied to other file(type)s.
It's reasonable to want to use the command from one file to compile another.
In particular, the command from a translation unit to parse a related header:
{"file": "foo.h", "command": "clang foo.cpp"}
This is largely what InterpolatingCompilationDatabase tries to do.
To do this correctly can require nontrivial changes to the argv, because the
file extension affects semantics. e.g. here we must add "-x c++header".
When external tools compile commands for different files, we should apply the
same adjustments. This is better than telling people to "fix their tools":
- simple e.g. python scripts shouldn't have to interpret clang argv
- this is a good way to represent the intent "parse header X in the context of
file Y", which can work even if X is not self-contained. clangd does not
support this today, but some other tools do, and we may one day.
This issue is discussed in https://github.com/clangd/clangd/issues/519
Differential Revision: https://reviews.llvm.org/D116167
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions