Using clang-tidy to lint whitespace issues?

Green horn questions:

At Isilon we are looking into the possibility of using clang-tidy to do some of our C and C++ linting, specifically to create some clang-tidy checks out of BSD’s style(9). I’m curious about how/if we can check for whitespace issues (e.g. having spaces and not tabs at the start of each line in the source) using this tool. It looks like the AST style of check is how most checks are written, but I’m wondering if it can be used for checking whitespace line-by-line in the source?

And how does macro expansion play with that? I notice that after running clang-check -ast-print on a simple file, the macros appear to have been already expanded. I’m worried that expanding multi-line macros that have their own whitespace etc. could end up making whitespace checks report false positives. Is it possible to use the information in the AST to get around that? Other ideas?


Matt Bryan
Principal Software Development Engineer
Vertical Campaigns Team
EMC Isilon