[llvm-branch-commits] [clang] [Clang] Load pass plugins before parsing LLVM options (PR #171868)
Stefan Gränitz via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 15 05:27:02 PST 2025
================
@@ -233,6 +234,20 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
Clang->LoadRequestedPlugins();
+ // Load and store pass plugins for the back-end. Store the loaded pass plugins
+ // here and store references to these in CodeGenOpts to avoid pulling in the
+ // entire PassPlugin dependency chain in CodeGenOpts.
+ std::vector<std::unique_ptr<llvm::PassPlugin>> PassPlugins;
+ for (const std::string &Path : Clang->getCodeGenOpts().PassPluginNames) {
----------------
weliveindetail wrote:
> It seems the motivation was to add pass callbacks without loading a plugin shared library and without recompiling Clang
Not sure. The LLVMPrintFunctionNames example builds a .so and the test loads it with `-load`. To me this looks like a parallel mechanism.
> Clang should not have multiple ways to deal with plugins
Clang should handle its own frontend plugins. And it should accept and forward LLVM pass plugins. Rust and Swift do that as well. (BTW this patch doesn't anything in that regard, it just moves things around to improve parameter handling.)
https://github.com/llvm/llvm-project/pull/171868
More information about the llvm-branch-commits
mailing list