[llvm] [Support][Casting] Add predicates for `isa*` functions (PR #83753)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 10:24:32 PST 2024


kuhar wrote:

> > * Any code that explicitly specified the `From` template argument would **silently** break (the interpretation would change to another possible cast type)
> 
> Hmm, not sure I follow this - I'd expect the functor to have one template parameter, so anyone explicitly specifying 2 would fail to compile at least...

Currently, `isa` is defined like this:
https://github.com/llvm/llvm-project/blob/ee044d5e651787c5d73b37b2cbb7ca6444bb0502/llvm/include/llvm/Support/Casting.h#L547-L555

I'm worried that the meaning of `&isa</*To=*/T1, /*From=*/T2>` would change to `&isa</*To1=*/ T1, /*To2=*/T2>` in the context of something like:
```c++
auto fPtr = &isa<VectorType, Type>;
...
(*ftr)(ptr);
 ```

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


More information about the llvm-commits mailing list