[clang] [CIR] Add support for exact dynamic casts (PR #164007)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 17 15:07:43 PDT 2025
andykaylor wrote:
> The class traversal logic looks to be pretty much identical to the non-CIR final class dynamic_cast optimization (`CGCXXABI::getExactDynamicCastInfo`) is it possible to reuse that logic? maybe extending it if additional information is needed? (also while trying to find that code again I found yet another near copy of the same logic. _sigh_ :D0
Unfortunately, this is a recurring problem with CIR codegen. We've tried to keep the basic code structure as close to LLVM IR codegen as is practical. There are, of course, many places where we could be sharing the actual code for things that don't involve the target substrate. We've implemented a few of these, and for others we've just left comments saying that it should be done. We're trying to find the right balance between making fast progress on the upstreaming versus accumulating technical debt and baking in fragility.
Is the other "near copy" you were referring to in `computeOffsetHint`?
Where would you suggest moving this logic? `ASTRecordLayout` maybe?
https://github.com/llvm/llvm-project/pull/164007
More information about the cfe-commits
mailing list