Closed Lancern closed 3 months ago
Rebased onto the latest main
.
Rebased onto the latest main
.
BTW, I found a bug in the previous related patch. The cir.dyn_cast
operation is lowered to a cir.ternary
that guards against the source pointer being null. I got the true branch and the false branch wrong. Fixed it inline together with the latest rebase and improvements.
This patch update the CIRGen of
dynamic_cast
expressions and make it start to generatecir.dyn_cast
operations fordynamic_cast
expressions that cast to a void pointer. This patch also updates the lowering prepare pass so that it lowers suchcir.dyn_cast
operations to the code emitted before this patch.This patch adds a new attribute
#cir.dyn_cast_to_void
that carries ABI- specific information about a dynamic-cast-to-void-pointer operation. For downcasts and sidecasts, thecir.dyn_cast
operation continues to hold a#cir.dyn_cast_info
attribute. For dynamic-cast-to-void-pointer, thecir.dyn_cast
operation holds a#cir.dyn_cast_to_void
attribute instead.