[libcxx-commits] [libcxxabi] [libc++abi] Handle null pointer-to-object: Issue #64593 (PR #68076)

Iain Sandoe via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 4 00:34:35 PDT 2023


iains wrote:

> > > I'm... not sure it's okay to change v-tables in the `std::type_info` hierarchy like this. In theory it's non-ABI and purely an internal implementation detail of the C++ runtime, but in practice there are some other subclasses out there, like in the ObjC runtime.
> > 
> > 
> > My, perhaps flawed, understanding is that Objective-C is supposed to inherit from the parent language and thus, absent a specification to the contrary, a bug in the exception handling here would also be a bug in the Objective-C exception handling, thus it should also import the fix)?
> 
> It's not that Objective-C doesn't want the fix, it's that Apple's Objective-C runtime (at least) has its own subclass of `std::type_info` so that it can properly interoperate with C++ exceptions (e.g. ObjC exceptions can be caught with `catch (...)`).

Right, that was what I expected;  It would be good for me to understand the constraints better (in case it opens up other opportunities for fixes).  e.g. It seems to me that pushing all state into the  `__dynamic_cast_info` might allow us to keep the private API unchanged - but it would not alter that the private implementation has changed (and the `__dynamic_cast_info` would not be interoperable with an older version).

> > (agreed that the layout change obfuscates some of the change purpose - most of it is just initialising the new bool in __dynamic_cast_info). However, if you like I can find my original patch (without the layout changes) and force-push that here?
> 
> I think that would be better, yeah.

Done, and rebased/retested (so we expect the formatting check to fail for now).


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


More information about the libcxx-commits mailing list