There’s many patterns we learn to recognise in software, good and bad - and increasingly, we expect our compilers to spot those in our development. But we can improve on that - modern compilers give us all the building blocks to add static checking specific to a particular API, framework or even project.
Automating these checks can increase code quality, simplify code reviews, and enforce many stylistic points: for example using a particular string encoding, or avoiding certain APIs. Here we present an example of such a tool: Clazy, a plugin for the Clang compiler, focused around the Qt libraries. Clazy extends the compiler with additional warnings and checks specific to Qt, making development easier and more robust. We will show how some checks are implemented, and how this technique could be applied to other large frameworks usefully.