[llvm] [llvm] Use dyn_cast_if_present instead of dyn_cast_or_null (NFC) (PR #75733)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 17 12:07:44 PST 2023


MaskRay wrote:

This has been controversial: https://discourse.llvm.org/t/psa-swapping-out-or-null-with-if-present/65018/12

I agree with the group people that prefer `*_or_null` over `*_if_present`. As the most commonly-used operation, `*_or_null` immediately tells readers that the call site is about a pointer, while with `*_if_present` readers would think whether there is any magic.

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


More information about the llvm-commits mailing list