Since the documentation is not always up to date. I always look at other checkers.
The SimpleStreamChecker is quite small and there is the “Building a Checker in 24 hours” talk explaining it.
After looking at your source, I noticed you are missing the following lines:
bool ento::shouldRegisterMainCallChecker(const CheckerManager &mgr) {
return true;
}
see here fore more information.
When I ran it on you test file i got the following:
$ bin/scan-build -enable-checker alpha.unix.MainCall bin/clang -g ~/test.cpp
scan-build: Using '/home/mschroetter/project/llvm-project/build/bin/clang-15' for static analysis
/home/mschroetter/test.cpp:4:25: warning: alpha.unix.MainCall [alpha.unix.MainCall]
int exit_code = foo(argc, argv);
^~~~~~~~~~~~~~~
1 warning generated.
scan-build: Analysis run complete.
scan-build: 1 bug found.
scan-build: Run 'scan-view /tmp/scan-build-2022-11-29-231029-8632-1' to examine bug reports.
I also needed to enable the checker because I put it under alpha.unix in the checkers.td and those are always disabled by default.