[llvm] [IR] Fix deprecated-enum-enum-conversion C++20 warnings; NFC (PR #203277)
Sven van Haastregt via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 07:08:53 PDT 2026
https://github.com/svenvh created https://github.com/llvm/llvm-project/pull/203277
This addition of enum values resulted in many warnings of the form
warning: arithmetic between different enumeration types
'llvm::Value::ValueTy' and 'llvm::Instruction::TermOps' is
deprecated
>From 268716e5bf828a074624d9a34b4d8f1e7a2e817b Mon Sep 17 00:00:00 2001
From: Sven van Haastregt <sven.vanhaastregt at arm.com>
Date: Thu, 11 Jun 2026 11:23:14 +0100
Subject: [PATCH] [IR] Fix deprecated-enum-enum-conversion C++20 warnings; NFC
This addition of enum values resulted in many warnings of the form
warning: arithmetic between different enumeration types
'llvm::Value::ValueTy' and 'llvm::Instruction::TermOps' is
deprecated
---
llvm/lib/IR/Value.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 6f71a5093e4a3..1b72717e8389e 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -13,6 +13,7 @@
#include "llvm/IR/Value.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
@@ -123,7 +124,7 @@ void Value::deleteValue() {
#include "llvm/IR/Value.def"
#define HANDLE_INST(N, OPC, CLASS) \
- case Value::InstructionVal + Instruction::OPC: \
+ case addEnumValues(Value::InstructionVal, Instruction::OPC): \
delete static_cast<CLASS *>(this); \
break;
#define HANDLE_USER_INST(N, OPC, CLASS)
More information about the llvm-commits
mailing list