[llvm] [llvm] Specialize 'NoCFIValue::getType()' (PR #72923)

Youngsuk Kim via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 01:20:42 PST 2023


================
@@ -975,6 +975,11 @@ class NoCFIValue final : public Constant {
     return cast<GlobalValue>(Op<0>().get());
   }
 
+  /// NoCFIValue is always a pointer.
+  inline PointerType *getType() const {
----------------
JOE1994 wrote:

I'm fine with removing `inline` from here.
I copied [the existing implementation of `ConstantPointerNull::getType()`](https://github.com/llvm/llvm-project/blob/0cfa10955f716d58d7a223e2e39625674e703931/llvm/include/llvm/IR/Constants.h#L533-L551
) and hence the `inline`.
I see that implementation of `GlobalValue::getType()` doesn't have `inline`.

According to https://en.cppreference.com/w/cpp/language/inline, it seems `inline` is already implied in this case.

> A function defined entirely inside a [class/struct/union definition](https://en.cppreference.com/w/cpp/language/classes), whether it's a member function or a non-member friend function, is implicitly an inline function

https://github.com/llvm/llvm-project/pull/72923


More information about the llvm-commits mailing list