[llvm] [llvm] Specialize 'NoCFIValue::getType()' (PR #72923)
Youngsuk Kim via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 20 15:07:22 PST 2023
https://github.com/JOE1994 created https://github.com/llvm/llvm-project/pull/72923
Specialize `NoCFIValue::getType()` to give a more detailed type hint to clients.
>From 3fa39f7b92f3415743401411754df0ea4f485f71 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim <youngsuk.kim at hpe.com>
Date: Mon, 20 Nov 2023 16:37:37 -0600
Subject: [PATCH] [llvm] Specialize 'NoCFIValue::getType()'
Specialize `NoCFIValue::getType()` to give a more detailed type hint to
clients.
---
llvm/include/llvm/IR/Constants.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index c443ec58822b007..48890593ce1a9ed 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -975,6 +975,11 @@ class NoCFIValue final : public Constant {
return cast<GlobalValue>(Op<0>().get());
}
+ /// NoCFIValue is always a pointer.
+ inline PointerType *getType() const {
+ return cast<PointerType>(Value::getType());
+ }
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
return V->getValueID() == NoCFIValueVal;
More information about the llvm-commits
mailing list