[llvm] e41da79 - [CodeGen] Make TargetRegisterInfo destructor public (NFC) (#157341)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 7 08:57:42 PDT 2025


Author: Sergei Barannikov
Date: 2025-09-07T18:57:38+03:00
New Revision: e41da79198f77faab7b9f110a734f6b03bd8483c

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

LOG: [CodeGen] Make TargetRegisterInfo destructor public (NFC) (#157341)

All in-tree targets store target-specific TRI in target-specific
Subtarget/InstrInfo class by value, but some downstream targets may
prefer to store it as `std::unique_ptr<const TargetRegisterInfo>` (to
avoid inclusion of MyTargetRegisterInfo.h in MySubtarget.h).

Making the destructor public makes this possible, and also follows
general C++ guidelines (the destructor should be either public virtual
or protected non-virtual).

All other related classes already have their destructors public.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/TargetRegisterInfo.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/TargetRegisterInfo.h b/llvm/include/llvm/CodeGen/TargetRegisterInfo.h
index 12ee51f130262..73ccc8ed5b11d 100644
--- a/llvm/include/llvm/CodeGen/TargetRegisterInfo.h
+++ b/llvm/include/llvm/CodeGen/TargetRegisterInfo.h
@@ -273,9 +273,10 @@ class LLVM_ABI TargetRegisterInfo : public MCRegisterInfo {
                      const RegClassInfo *const RCIs,
                      const MVT::SimpleValueType *const RCVTLists,
                      unsigned Mode = 0);
-  virtual ~TargetRegisterInfo();
 
 public:
+  virtual ~TargetRegisterInfo();
+
   /// Return the number of registers for the function. (may overestimate)
   virtual unsigned getNumSupportedRegs(const MachineFunction &) const {
     return getNumRegs();


        


More information about the llvm-commits mailing list