This patch adds support for the C11 _Static_assert macro to clang-tidy's misc-static-assert checker. There are a few things I'm not overly satisfied with, and welcome suggestions on how to improve, if desired.
- If <assert.h> is included, then static_assert() is also fine to use. Presumably, in order for the assert() check to trigger, <assert.h> has to be included, but I don't feel particularly comfortable with that assumption. If there's a way to access a Preprocessor instance from check(), we can use getMacroDefinitionAtLoc() to determine whether static_assert() is defined and a valid replacement for assert(). For right now, I'm always using _Static_assert() in C11 mode to be on the safe side.
- My Python skills are rudimentary at best. If there's a better way to update check_clang_tidy.py to handle file extensions, that would be great. This change is required or else the script fails on .c test cases that check fixes because of writing out to a .tmp.cpp file instead of a .tmp.c file conflicts with the language options specified on the RUN line.
~Aaron
I'm not sure that c99 is a good default for C code here. The existing .c tests don't rely on this, and the tests you're adding override -std anyway. I'd change this to ['--', '--std=c++11'] if extension == '.cpp' else ['--'].