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

John McCall via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 15:30:48 PDT 2023


rjmccall 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 (...)`).

> (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.

> 2. At the moment, I cannot see a way to fix this that does not involve changing the private implementation - and thus potentially impacting Objective-C.

Let me tag in @mikeash for this.

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


More information about the llvm-commits mailing list