I come across a lot of dyn_cast in a codebase I am working on.
Is it the same thing as dynamic_cast ? or something different ? I searched a bit but couldn't find much info..
I come across a lot of dyn_cast in a codebase I am working on.
Is it the same thing as dynamic_cast ? or something different ? I searched a bit but couldn't find much info..
dyn_cast
is part of the LLVM API (and also is the first, second, third, etc.. hit on google) works just like dynamic_cast, however, one difference is that the class doesn't require a v-table like dynamic_cast. Please see the manual for more info.
Actually, it is llvm::dyn_cast_or_null
which is equivalent to dynamic_cast
.
These will produce a null pointer if passed a null pointer, whereas llvm::dyn_cast
will bail.