[llvm] ac9204d - MCExpr: Remove VK_None
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 22:36:48 PDT 2025
Author: Fangrui Song
Date: 2025-06-27T22:36:43-07:00
New Revision: ac9204de7d4f9010506474b532654fa4bd15edfc
URL: https://github.com/llvm/llvm-project/commit/ac9204de7d4f9010506474b532654fa4bd15edfc
DIFF: https://github.com/llvm/llvm-project/commit/ac9204de7d4f9010506474b532654fa4bd15edfc.diff
LOG: 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.
Added:
Modified:
llvm/include/llvm/MC/MCExpr.h
llvm/lib/CodeGen/AsmPrinter/WinException.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h
index 8d66ed22875df..4b0723620b171 100644
--- a/llvm/include/llvm/MC/MCExpr.h
+++ b/llvm/include/llvm/MC/MCExpr.h
@@ -196,9 +196,7 @@ class MCSymbolRefExpr : public MCExpr {
// expressions with @). MCTargetExpr, as used by AArch64 and RISC-V, offers a
// cleaner approach.
enum VariantKind : uint16_t {
- VK_None,
-
- VK_SECREL,
+ VK_SECREL = 1,
VK_WEAKREF, // The link between the symbols in .weakref foo, bar
VK_COFF_IMGREL32, // symbol at imgrel (image-relative)
@@ -219,7 +217,7 @@ class MCSymbolRefExpr : public MCExpr {
static const MCSymbolRefExpr *create(const MCSymbol *Symbol, MCContext &Ctx,
SMLoc Loc = SMLoc()) {
- return MCSymbolRefExpr::create(Symbol, VK_None, Ctx, Loc);
+ return MCSymbolRefExpr::create(Symbol, 0, Ctx, Loc);
}
LLVM_ABI static const MCSymbolRefExpr *create(const MCSymbol *Symbol,
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
index 55d1350e446ab..dccd71fffe053 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
@@ -308,10 +308,8 @@ void WinException::endFuncletImpl() {
const MCExpr *WinException::create32bitRef(const MCSymbol *Value) {
if (!Value)
return MCConstantExpr::create(0, Asm->OutContext);
- return MCSymbolRefExpr::create(Value, useImageRel32
- ? MCSymbolRefExpr::VK_COFF_IMGREL32
- : MCSymbolRefExpr::VK_None,
- Asm->OutContext);
+ auto Spec = useImageRel32 ? uint16_t(MCSymbolRefExpr::VK_COFF_IMGREL32) : 0;
+ return MCSymbolRefExpr::create(Value, Spec, Asm->OutContext);
}
const MCExpr *WinException::create32bitRef(const GlobalValue *GV) {
More information about the llvm-commits
mailing list