Closed davidchisnall closed 1 year ago
Sorry, you are correct. The change does fix the issue mentioned in https://github.com/llvm/llvm-project/issues/56056.
Also using #if defined(__OBJC__) && __has_attribute(ns_returns_retained)
will fix the warnings.
I was looking at another crash with LLVM 14 when accessing GNUstep Base classes for the first time (e.g. calling [NSUserDefaults standardUserDefaults]
crashes in _objc_block_trampoline_end_sret
), which I incorrectly thought was the same issue. I will look into that in more detail and report it separately.
I'm a bit confused. With this change, clang generates the right IR for me. The error is coming from C files, where
id
isstruct objc_object*
and so isn't treated as an Objective-C type. We should gate that attribute ondefined(__OBJC__)
.