[all-commits] [llvm/llvm-project] b7bb25: Warn on misuse of DiagnosticInfo classes that hold...

Justin Bogner via All-commits all-commits at lists.llvm.org
Wed May 28 12:27:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7bb2567032f2264715234bcd8ddf55414d99b5d
      https://github.com/llvm/llvm-project/commit/b7bb2567032f2264715234bcd8ddf55414d99b5d
  Author: Justin Bogner <mail at justinbogner.com>
  Date:   2025-05-28 (Wed, 28 May 2025)

  Changed paths:
    M llvm/include/llvm/IR/DiagnosticInfo.h
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    M llvm/lib/LTO/LTOCodeGenerator.cpp
    M llvm/lib/LTO/ThinLTOCodeGenerator.cpp
    M llvm/lib/Linker/LinkDiagnosticInfo.h
    M llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
    M llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
    M llvm/lib/Target/AMDGPU/SIISelLowering.cpp
    M llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
    M llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp
    M llvm/lib/Target/ARM/ARMISelLowering.cpp
    M llvm/lib/Target/ARM/ARMMCInstLower.cpp
    M llvm/lib/Target/BPF/BPFPreserveStaticOffset.cpp
    M llvm/lib/Target/BPF/BPFRegisterInfo.cpp
    M llvm/lib/Target/DirectX/DXILOpLowering.cpp
    M llvm/lib/Target/DirectX/DXILTranslateMetadata.cpp
    M llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
    M llvm/lib/Transforms/Instrumentation/KCFI.cpp

  Log Message:
  -----------
  Warn on misuse of DiagnosticInfo classes that hold Twines (#137397)

This annotates the `Twine` passed to the constructors of the various
DiagnosticInfo subclasses with `[[clang::lifetimebound]]`, which causes
us to warn when we would try to print the twine after it had already
been destructed.

We also update `DiagnosticInfoUnsupported` to hold a `const Twine &`
like all of the other DiagnosticInfo classes, since this warning allows
us to clean up all of the places where it was being used incorrectly.



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