[all-commits] [llvm/llvm-project] c04d9d: MCAsmStreamer: Replace the MCInstPrinter * paramet...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Apr 10 21:25:58 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c04d9d57ee4c116ecc1222b1f4458a21be13ac15
      https://github.com/llvm/llvm-project/commit/c04d9d57ee4c116ecc1222b1f4458a21be13ac15
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-04-10 (Thu, 10 Apr 2025)

  Changed paths:
    M bolt/lib/Passes/AsmDump.cpp
    M clang/tools/driver/cc1as_main.cpp
    M llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
    M llvm/include/llvm/MC/TargetRegistry.h
    M llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp
    M llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
    M llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
    M llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.h
    M llvm/lib/MC/MCAsmStreamer.cpp
    M llvm/lib/MC/TargetRegistry.cpp
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.h
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
    M llvm/test/tools/llvm-mc/disassembler-options.test
    M llvm/tools/llvm-mc/llvm-mc.cpp
    M llvm/tools/llvm-ml/llvm-ml.cpp

  Log Message:
  -----------
  MCAsmStreamer: Replace the MCInstPrinter * parameter with unique_ptr

... to clarify ownership, aligning with other parameters. Using
`std::unique_ptr` encourages users to manage `createMCInstPrinter` with
a unique_ptr instead of a raw pointer, reducing the risk of memory
leaks.

* llvm-mc: fix a leak and update llvm/test/tools/llvm-mc/disassembler-options.test
* #121078 copied the llvm-mc code to CodeGenTargetMachineImpl and made
  the same mistake. Fixed by 2b8cc651dca0c000ee18ec79bd5de4826156c9d6

Using unique_ptr requires #include MCInstPrinter.h in a few translation
units.

* Delete a createAsmStreamer overload I deprecated in 2024
* SystemZMCTargetDesc.cpp: rename to `createSystemZAsmStreamer` to fix
  an overload conflict.

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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list