[clang] [llvm] MCAsmStreamer: Replace the MCInstPrinter * parameter with unique_ptr (PR #135128)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 10 08:55:56 PDT 2025


================
@@ -541,8 +542,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
 
   // FIXME: There is a bit of code duplication with addPassesToEmitFile.
   if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
-    MCInstPrinter *IP = TheTarget->createMCInstPrinter(
-        llvm::Triple(Opts.Triple), Opts.OutputAsmVariant, *MAI, *MCII, *MRI);
+    std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
----------------
MaskRay wrote:

Thanks for the review!

I agree... That said, a lot of `create*` functions in `llvm/include/llvm/MC/TargetRegistry.h` return a raw pointer, so I feel that we'll have to keep createMCInstPrinter behave so...

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


More information about the cfe-commits mailing list