[llvm] [IR] Fix deprecated-enum-enum-conversion C++20 warnings; NFC (PR #203277)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 07:09:28 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Sven van Haastregt (svenvh)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/203277.diff
1 Files Affected:
- (modified) llvm/lib/IR/Value.cpp (+2-1)
``````````diff
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/203277
More information about the llvm-commits
mailing list