> On Jun 20, 2015, at 12:10 PM, Aaron Ballman <[email protected]> wrote:
>
> On Fri, Jun 19, 2015 at 2:14 PM, Douglas Gregor <[email protected]
> <mailto:[email protected]>> wrote:
>
>> + for (const auto *propertyImpl : impDecl->property_impls()) {
>> + const auto *property = propertyImpl->getPropertyDecl();
>> +
>> + // Warn about null_resettable properties with synthesized setters,
>> + // because the setter won't properly handle nil.
>> + if (propertyImpl->getPropertyImplementation()
>> + == ObjCPropertyImplDecl::Synthesize &&
>> + (property->getPropertyAttributes() &
>> + ObjCPropertyDecl::OBJC_PR_null_resettable) &&
>
> The more I see the bitwise tests, the more I wonder if having a
> propertyAttributeIsSet() function might make sense?
Probably, yes.
>
>> + property->getGetterMethodDecl() &&
>> + property->getSetterMethodDecl()) {
>> + auto *getterMethod = property->getGetterMethodDecl();
>> + auto *setterMethod = property->getSetterMethodDecl();
>> + if (!impDecl->getInstanceMethod(setterMethod->getSelector()) &&
>> + !impDecl->getInstanceMethod(getterMethod->getSelector())) {
>> + SourceLocation loc = propertyImpl->getLocation();
>> + if (loc.isInvalid())
>> + loc = impDecl->getLocStart();
>
> Under what circumstances would loc be invalid here? (I may simply be
> unfamiliar with ObjC and that's not a problem.)
Getters and setters can be synthesized by the @implementation, which means they
won’t have useful source locations.
(Comments appreciated and cleanup commits coming, thanks!)
- Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits