[llvm] [LTO] Refactor LTO link optimization remarks handling using RAII (NFC) (PR #181269)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 10:42:06 PST 2026


================
@@ -427,6 +427,21 @@ class LTO {
     LTOK_UnifiedThin,
   };
 
+  /// RAII guard for optimization remarks and LTO-link diagnostics.
+  struct DiagnosticSession {
----------------
teresajohnson wrote:

Let me investigate. Note that this is not new, we previously called finalizeOptimizationRemarks on every return of the old scope in runRegularLTO, and I was trying to keep this as NFC as possible. Looks like finalizeOptimizationRemarks does a few other things, such as flush, with a comment about how that is needed "in case the linker doesn't call the global destructors before exiting".

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


More information about the llvm-commits mailing list