Automatically load LLVM pass regardless of Clang driver mode


Perhaps this is a silly question, but how do I ensure that a LLVM pass
(implemented as a plugin) is always loaded by Clang, regardless of the
driver mode? Currently, for the old pass manager, I register the pass
using llvm::RegisterPass<> and llvm::RegisterStandardPasses, and for the
new pass manager, llvm::PassPluginLibraryInfo and
PassBuilder.registerPipeline*Callback. At runtime, I'm passing "-Xclang
-load -Xclang <path>" to load the pass, but this doesn't seem to work
for cc1as because those arguments are stripped out. This can break
compilation if I'm also specifying pass-specific arguments using
"-mllvm", because those arguments aren't stripped but become
unrecognized without the pass. I've also tried "-fplugin=" and
"-fpass-plugin=", but they seem to be stripped as well.



As far as I understand, clang -cc1as does not instantiate a pass
manager, hence a pass plugin would be quite useless. Otherwise,
handling plugin options for -cc1as might just have been forgotten in