[libcxx-commits] [PATCH] D117268: [libc++] Install clang-tidy in docker containers and create compile_commands.json

Sam McCall via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 16 07:40:52 PST 2022


sammccall added a comment.

In D117268#3244971 <https://reviews.llvm.org/D117268#3244971>, @ldionne wrote:

> @sammccall Do you know whether `clang-tidy` can use `compile_flags.txt`? If it did, that could perhaps solve both this issue and also https://github.com/llvm/llvm-project/issues/45348.

Yes and no:

- if you run clang-tidy on a file, it will correctly discover `compile_flags.txt` (or you can force it with `-p`) and use its flags
- but if you want to run clang-tidy on a whole project, you need to somehow choose what files are in scope. `run-clang-tidy.py` is the usual tool for this and only supports compile_commands.json.

So it depends exactly how you plan to run clang-tidy.

> I looked at `compile_commands.json` locally and it made it clear that we can't ship it as part of our installation, but `compile_flags.txt` would be an option. Thoughts?

FWIW, agree that compile_commands.json is never portable across machines but a carefully-constructed compile_flags.txt can be.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117268/new/

https://reviews.llvm.org/D117268



More information about the libcxx-commits mailing list