As now explained in the comments, the problem was due to invoking the originally installed clang-tidy
rather than the one built from the modified sources. The latter is found in $BUILD/bin/clang-tidy
where $BUILD
is the directory in which cmake
was run.
To make this Q+A potentially more useful to others, I'll summarize some relevant troubleshooting:
If $BUILD/bin/clang-tidy
is missing but other programs like $BUILD/bin/clang
are present, the problem is likely due to how cmake
was invoked. In particular, one must pass -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra"
to cmake
in order to enable the clang-tools-extra
project, of which clang-tidy
is a part.
If you have a clang-tidy
, you can run the strings
program on it to see if string literals from your custom check are present in the binary. If not, then the problem is likely related to the build system, such as a missing entry in CMakeLists.txt
or failing to re-run the build properly.
If the check has been linked in, then it should appear in the output of $BUILD/bin/clang-tidy -checks="*" --list-checks
. If it does not, then the problem is likely with how the check is being registered (with registerCheck
; see ClangTidyCheckFactories
).