After examining the remaining uses of LangOptions.ObjCAutoRefCount, found a some additional places to also check for ObjCWeak not covered by previous test cases. Added a test file to verify all the code paths that were changed.
|3773 ↗||(On Diff #92220)|
Yes, but I didn't see how to extract that information, which is on the internal QualType. But after examining the usage of this function in SemaInit.cpp:6681, I think we need something similar to the isObjCLifetimeType() implementation above.
Oh, I see what's happening here. The special case for ARC is actually wholly unnecessary. The code's been written as if MTE->getType() for an ARC temporary will just have type "id". In fact, it'll have a lifetime-qualified type, dependent on the type of the reference which has been bound to it. So we need to mark that there's a temporary cleanup if the type has non-trivial lifetime, i.e. if MTE->getType().hasNonTrivialObjCLifetime(); but this is already considered as part of MTE->getType().isDestructedType(), and the storage-duration condition there is correct as well. So really we should just delete this entire clause.
That should eliminate the need for Type::isNonTrivialObjCLifetimeType(). In general, we don't want methods like that to ever exist: lifetime is determined by qualifiers, and querying a Type instead of a QualType has the potential to implicitly remove qualifiers.