PlatformIO Community

Support for clang diagnostics tools

Hi!

Some useful clang-diagnostic tools (like clang-tidy and clang-check) use compile_commands.json for information about the building process, but it’s kind of complicated to generate them (although one can use bear or enhanced scan-build reimplementation). However, in the case of platformio it’s unnecessary because these tools also support specifying compile flags via compile_flags.txt file. Its structure is very simple: just one flag per line. As we already can generate such a file for ccls it’s pretty easy to implement (the file contents should be .ccls without the first line specifying the compiler). I did some local testing and it seems to work.

1 Like

Since I’m a new user, I’m restricted to 2 links per post. Here’s the info about compile_flags.txt support.

1 Like

I like your idea about use of clang-tidy/clang-check… sounds like it would fit right in with the project inspection stuff that was recently released!

We have added recently support for Clang-tidy https://docs.platformio.org/en/latest/plus/check-tools/clang-tidy.html

1 Like