What is the clang cmdline equivalent to opts '-passes'?

With opt I can use -passes to activate the pass defined in LLVMHello

if(Name == "hello-new-pm-pass"){
   FPM.addPass(HelloNewPMPass());return true;
opt -disable-output -load-pass-plugin=./LLVMHello.so  -passes="hello-new-pm-pass" test.ll

What do I have to do to call it in clang as well?

clang -O3 -fexperimental-new-pass-manager -fpass-plugin=./LLVMHello.so test.cpp

does nothing - probably b.c. the pass is missing?

I don’t think there is an equivalent flag. My hand-waving guess is that -passes is really ( and probably only) designed for LLVM development so people didn’t find values to put it in clang. That said, personally I think it’s a good idea to have -passes in clang, maybe not a driver flag but just a frontend flag. Feel free to send a patch to add this feature and discuss with the wider community.

(and just in case you haven’t known, clang has switched to the new pass manager by default since version 12 or 13, so you don’t need to add -fexperimental-new-pass-manager anymore)