[llvm] 33a4dff - [AsmPrinter] Explicitly use EHStreamer type for EHHandlers (#191288)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 09:05:24 PDT 2026


Author: Aiden Grossman
Date: 2026-04-10T09:05:19-07:00
New Revision: 33a4dff19fa013734057af130c8561d61e6a0764

URL: https://github.com/llvm/llvm-project/commit/33a4dff19fa013734057af130c8561d61e6a0764
DIFF: https://github.com/llvm/llvm-project/commit/33a4dff19fa013734057af130c8561d61e6a0764.diff

LOG: [AsmPrinter] Explicitly use EHStreamer type for EHHandlers (#191288)

There is a note here that this causes warnings on some compilers, but it
is unclear what compilers. Clang does not warn on this, and this is the
only compiler that we guarantee to be warning free.

Also update uses of update handle additions to add to the right arrays.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/AsmPrinter.h
    llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index ec17b54357acd..260de40ac3e42 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -236,9 +236,7 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
   MCSymbol *CurrentFnBeginLocal = nullptr;
 
   /// A handle to the EH info emitter (if present).
-  // Only for EHStreamer subtypes, but some C++ compilers will incorrectly warn
-  // us if we declare that directly.
-  SmallVector<std::unique_ptr<AsmPrinterHandler>, 1> EHHandlers;
+  SmallVector<std::unique_ptr<EHStreamer>, 1> EHHandlers;
 
   // A vector of all Debuginfo emitters we should use. Protected so that
   // targets can add their own. This vector maintains ownership of the

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 5fdf88831892f..66a95a16e9538 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -705,11 +705,11 @@ bool AsmPrinter::doInitialization(Module &M) {
     break;
   }
   if (ES)
-    Handlers.push_back(std::unique_ptr<EHStreamer>(ES));
+    EHHandlers.push_back(std::unique_ptr<EHStreamer>(ES));
 
   // All CFG modes required the tables emitted.
   if (M.getControlFlowGuardMode() != ControlFlowGuardMode::Disabled)
-    EHHandlers.push_back(std::make_unique<WinCFGuard>(this));
+    Handlers.push_back(std::make_unique<WinCFGuard>(this));
 
   for (auto &Handler : Handlers)
     Handler->beginModule(&M);


        


More information about the llvm-commits mailing list