[llvm-dev] [RFC] Should we add isa_or_null<>?

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 5 05:49:49 PDT 2019

On 05/04/2019 09:13, via llvm-dev wrote:
> I think "isa_nonnull" would read fine too. To me, the extra "and" makes 
> the ordering more of an issue.

At the risk of bikeshedding:

To me, isa_nonnull sounds as if the caller is guaranteeing that the 
argument is nonnull.  I don't think I've seen it in LLVM, but elsewhere 
I've come across a convention of adding nonnull variants of functions 
that skip null checks and pass the non-null restriction to the caller.

I wonder if the better solution is to rename isa to isa_nonnull and 
introduce a new isa that can take a null argument.  If these have the 
correct nullability annotations then anyone building with clang should 
get a warning if they use the wrong one...


More information about the llvm-dev mailing list