MCSymbolRefExpr: Migrate away from deprecated VariantKind

This commit is contained in:
Fangrui Song
2025-06-28 15:48:43 -07:00
parent 2ed0401612
commit aa8afadd25
2 changed files with 7 additions and 12 deletions

View File

@@ -57,6 +57,7 @@ private:
bool InSet) const;
protected:
using Spec = uint16_t;
explicit MCExpr(ExprKind Kind, SMLoc Loc, unsigned SubclassData = 0)
: Kind(Kind), SubclassData(SubclassData), Loc(Loc) {
assert(SubclassData < (1 << NumSubclassDataBits) &&
@@ -200,7 +201,7 @@ private:
/// The symbol being referenced.
const MCSymbol *Symbol;
explicit MCSymbolRefExpr(const MCSymbol *Symbol, VariantKind Kind,
explicit MCSymbolRefExpr(const MCSymbol *Symbol, Spec specifier,
const MCAsmInfo *MAI, SMLoc Loc = SMLoc());
public:
@@ -213,13 +214,8 @@ public:
}
LLVM_ABI static const MCSymbolRefExpr *create(const MCSymbol *Symbol,
VariantKind Kind,
MCContext &Ctx,
Spec specifier, MCContext &Ctx,
SMLoc Loc = SMLoc());
static const MCSymbolRefExpr *create(const MCSymbol *Symbol, uint16_t Kind,
MCContext &Ctx, SMLoc Loc = SMLoc()) {
return MCSymbolRefExpr::create(Symbol, VariantKind(Kind), Ctx, Loc);
}
/// @}
/// \name Accessors
@@ -495,7 +491,6 @@ public:
/// MCExprs are bump pointer allocated and not destructed.
class LLVM_ABI MCSpecifierExpr : public MCExpr {
protected:
using Spec = uint16_t;
const MCExpr *Expr;
// Target-specific relocation specifier code
const Spec specifier;

View File

@@ -217,16 +217,16 @@ const MCConstantExpr *MCConstantExpr::create(int64_t Value, MCContext &Ctx,
/* *** */
MCSymbolRefExpr::MCSymbolRefExpr(const MCSymbol *Symbol, VariantKind Kind,
MCSymbolRefExpr::MCSymbolRefExpr(const MCSymbol *Symbol, Spec specifier,
const MCAsmInfo *MAI, SMLoc Loc)
: MCExpr(MCExpr::SymbolRef, Loc, Kind), Symbol(Symbol) {
: MCExpr(MCExpr::SymbolRef, Loc, specifier), Symbol(Symbol) {
assert(Symbol);
}
const MCSymbolRefExpr *MCSymbolRefExpr::create(const MCSymbol *Sym,
VariantKind Kind,
uint16_t specifier,
MCContext &Ctx, SMLoc Loc) {
return new (Ctx) MCSymbolRefExpr(Sym, Kind, Ctx.getAsmInfo(), Loc);
return new (Ctx) MCSymbolRefExpr(Sym, specifier, Ctx.getAsmInfo(), Loc);
}
/* *** */