[llvm] 49a706d - MCSpecifierExpr: Make dtor defaulted

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 7 23:25:34 PDT 2025


Author: Fangrui Song
Date: 2025-06-07T23:25:29-07:00
New Revision: 49a706d8efb1c894a56dfa574d59afd30a376fba

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

LOG: MCSpecifierExpr: Make dtor defaulted

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCExpr.h
    llvm/lib/MC/MCExpr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h
index 79be10af8baea..18e2aa14bd96f 100644
--- a/llvm/include/llvm/MC/MCExpr.h
+++ b/llvm/include/llvm/MC/MCExpr.h
@@ -506,6 +506,9 @@ class LLVM_ABI MCTargetExpr : public MCExpr {
 /// Extension point for target-specific MCExpr subclasses with a relocation
 /// specifier, serving as a replacement for MCSymbolRefExpr::VariantKind.
 /// Limit this to top-level use, avoiding its inclusion as a subexpression.
+///
+/// NOTE: All subclasses are required to have trivial destructors because
+/// MCExprs are bump pointer allocated and not destructed.
 class LLVM_ABI MCSpecifierExpr : public MCExpr {
 protected:
   using Spec = uint16_t;
@@ -516,7 +519,7 @@ class LLVM_ABI MCSpecifierExpr : public MCExpr {
 protected:
   explicit MCSpecifierExpr(const MCExpr *Expr, Spec S)
       : MCExpr(Specifier, SMLoc()), Expr(Expr), specifier(S) {}
-  virtual ~MCSpecifierExpr();
+  virtual ~MCSpecifierExpr() = default;
 
 public:
   Spec getSpecifier() const { return specifier; }

diff  --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index b1e25a28f3ae4..e4172bf83a206 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -767,8 +767,6 @@ MCFragment *MCExpr::findAssociatedFragment() const {
   llvm_unreachable("Invalid assembly expression kind!");
 }
 
-MCSpecifierExpr::~MCSpecifierExpr() {}
-
 bool MCSpecifierExpr::evaluateAsRelocatableImpl(MCValue &Res,
                                                 const MCAssembler *Asm) const {
   if (!getSubExpr()->evaluateAsRelocatable(Res, Asm))


        


More information about the llvm-commits mailing list