[cfe-dev] Automatically load LLVM pass regardless of Clang driver mode

Michael Kruse via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 4 14:38:29 PST 2020

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


Am Di., 4. Feb. 2020 um 16:18 Uhr schrieb Dominic Chen via cfe-dev
<cfe-dev at lists.llvm.org>:
> Hello,
> 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.
> Thanks,
> Dominic
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list