I got it!
-fprebuilt-module-path=CMakeFiles/foo.dir/
must be set:
bash-3.2$ pwd
/Users/clausklein/Workspace/cpp/cxx20/test/build
bash-3.2$ /usr/local/opt/llvm/bin/clang-tidy -extra-arg=-fprebuilt-module-path=CMakeFiles/foo.dir/ -p=/Users/clausklein/Workspace/cpp/cxx20/test/build /Users/clausklein/Workspace/cpp/cxx20/test/main.cxx
77759 warnings generated.
Suppressed 77759 warnings (77759 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
/usr/local/opt/llvm/bin/clang-tidy -extra-arg=-fprebuilt-module-path=CMakeFiles/foo.dir/ -p=/Users/clausklein/Workspace/cpp/cxx20/test/build /Users/clausklein/Workspace/cpp/cxx20/test/foo.cxx
/Users/clausklein/Workspace/cpp/cxx20/test/foo.cxx:15:11: warning: method 'helloworld' can be made static [readability-convert-member-functions-to-static]
void foo::helloworld() { std::cout << "hello world\n"; }
^
85168 warnings generated.
Suppressed 85167 warnings (85167 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
bash-3.2$