[llvm] fc8d618 - [IR] Fix deprecated-enum-enum-conversion C++20 warnings; NFC (#203277)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 00:38:25 PDT 2026
Author: Sven van Haastregt
Date: 2026-06-12T09:37:36+02:00
New Revision: fc8d61811e16874575a73df5e919201c903513c9
URL: https://github.com/llvm/llvm-project/commit/fc8d61811e16874575a73df5e919201c903513c9
DIFF: https://github.com/llvm/llvm-project/commit/fc8d61811e16874575a73df5e919201c903513c9.diff
LOG: [IR] Fix deprecated-enum-enum-conversion C++20 warnings; NFC (#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
Added:
Modified:
llvm/lib/IR/Value.cpp
Removed:
################################################################################
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