Skip to content

Commit ac9204d

Browse files
committed
MCExpr: Remove VK_None
`enum VariantKind` is deprecated. Targets are encouraged to use their own relocation specifier constants. MCSymbolRefExpr::create callers with a VK_None argument should switch to the overload with a VariantKind parameter.
1 parent e121f72 commit ac9204d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

llvm/include/llvm/MC/MCExpr.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ class MCSymbolRefExpr : public MCExpr {
196196
// expressions with @). MCTargetExpr, as used by AArch64 and RISC-V, offers a
197197
// cleaner approach.
198198
enum VariantKind : uint16_t {
199-
VK_None,
200-
201-
VK_SECREL,
199+
VK_SECREL = 1,
202200
VK_WEAKREF, // The link between the symbols in .weakref foo, bar
203201

204202
VK_COFF_IMGREL32, // symbol@imgrel (image-relative)
@@ -219,7 +217,7 @@ class MCSymbolRefExpr : public MCExpr {
219217

220218
static const MCSymbolRefExpr *create(const MCSymbol *Symbol, MCContext &Ctx,
221219
SMLoc Loc = SMLoc()) {
222-
return MCSymbolRefExpr::create(Symbol, VK_None, Ctx, Loc);
220+
return MCSymbolRefExpr::create(Symbol, 0, Ctx, Loc);
223221
}
224222

225223
LLVM_ABI static const MCSymbolRefExpr *create(const MCSymbol *Symbol,

llvm/lib/CodeGen/AsmPrinter/WinException.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,8 @@ void WinException::endFuncletImpl() {
308308
const MCExpr *WinException::create32bitRef(const MCSymbol *Value) {
309309
if (!Value)
310310
return MCConstantExpr::create(0, Asm->OutContext);
311-
return MCSymbolRefExpr::create(Value, useImageRel32
312-
? MCSymbolRefExpr::VK_COFF_IMGREL32
313-
: MCSymbolRefExpr::VK_None,
314-
Asm->OutContext);
311+
auto Spec = useImageRel32 ? uint16_t(MCSymbolRefExpr::VK_COFF_IMGREL32) : 0;
312+
return MCSymbolRefExpr::create(Value, Spec, Asm->OutContext);
315313
}
316314

317315
const MCExpr *WinException::create32bitRef(const GlobalValue *GV) {

0 commit comments

Comments
 (0)