[clang] [Frontend] Move -mllvm and loading of plugins to address a fixme. NFC (PR #192476)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 19:18:06 PDT 2026


================
@@ -945,19 +946,36 @@ bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input,
 // High-Level Operations
 
 void CompilerInstance::PrepareForExecution() {
+  if (PreparedForExecution)
+    return;
+  PreparedForExecution = true;
+
   // Set up the frontend timer for -ftime-report. BackendConsumer uses
-  // getTimerGroup() and getFrontendTimer() when TimePasses is set. In the
-  // cc1 driver path this was done in cc1_main before calling
-  // ExecuteCompilerInvocation; we consolidate it here so that all tools
-  // (cc1, clang-repl, libclang, etc.) get consistent behavior.
+  // getTimerGroup() and getFrontendTimer() when TimePasses is set.
   if (getCodeGenOpts().TimePasses && !FrontendTimer) {
     createFrontendTimer();
     getFrontendTimer().startTimer();
   }
 
-  // FIXME: Consider consolidating additional per-instance setup here:
-  // - llvm::timeTraceProfilerInitialize) when TimeTracePath is set.
-  // - Plugin loading (LoadRequestedPlugins) and -mllvm argument processing.
+  // Load plugins and pass plugins from -fplugin / -fpass-plugin.
+  LoadRequestedPlugins();
+
+  // Honor -mllvm.
+  //
+  // FIXME: Remove this, one day.
+  // This should happen AFTER plugins have been loaded!
----------------
ChuanqiXu9 wrote:

The comment is out of date now?

https://github.com/llvm/llvm-project/pull/192476


More information about the cfe-commits mailing list