Visual Studio has a feature that lets me enable clang-tidy checks. In the property pages, I went to Configuration properties, Code analysis, General and set "Enable Clang-Tidy" to "Yes":
In the Clang-Tidy section, Visual Studio allows me to enter Clang-Tidy rules:
However, it says: "Enable or disable ...". How do I enable a check and how do I disable a check? That input box just takes a string.
The checks are passed to the clang-tidy command line as is. This means:
-
in front of the checkclang-analyzer-*,-clang-analyzer-cplusplus*
As mentioned on https://clang.llvm.org/extra/clang-tidy/:
clang-tidy options: --checks=<string> - Comma-separated list of globs with optional '-' prefix. Globs are processed in order of appearance in the list. Globs without '-' prefix add checks with matching names to the set, globs with the '-' prefix remove checks with matching names from the set of enabled checks. This option's value is appended to the value of the 'Checks' option in .clang-tidy file, if any.