I read on Features that clangd embeds clang-tidy and shows clang-tidy warnings when passed the --clang-tidy argument, but don’t actually see that in my (admittedly rather custom) setup of clangd with the Monaco editor. For example bugprone-assert-side-effect: running clang-tidy -checks=-*,bugprone-assert-side-effect
on
#include <assert.h>
int function(int Param)
{
assert(++Param);
return Param;
}
produces
1 warning generated.
.../test.c:5:3: warning: side effect in assert() condition discarded in release builds [bugprone-assert-side-effect]
assert(++Param);
^
/usr/include/assert.h:108:19: note: expanded from macro 'assert'
((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \
^
as expected, but the Monaco editor talking to clangd --clang-tidy --clang-tidy-checks=-*,bugprone-assert-side-effect
(which otherwise does show clangd warnings) sees no problem with the code.
I’ve built clangd (and clang-tidy) as described on https://github.com/llvm/llvm-project/tree/main/clang-tools-extra/clangd - do I need to do anything special to build clangd integrated with clang-tidy? I also read that “not all checks work within clangd” - what would be a working example of a clang-tidy check within clangd?