r181847 - Objective-C [diagnostics] [QOI], when method is not

jahanian fjahanian at apple.com
Wed May 15 08:28:32 PDT 2013


On May 14, 2013, at 4:47 PM, Jordan Rose <jordan_rose at apple.com> wrote:

>> 
>> 
> 
> Bikeshedding on the diagnostic a little bit: "receiver is instance of class declared here" or even "receiver interface declared here". "object of the class" sounds very strange to me.
> 
> 
>> def note_receiver_is_id : Note<
>>   "receiver is treated with 'id' type for purpose of method lookup">;
>> def note_suppressed_class_declare : Note<
>> 
>> Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=181847&r1=181846&r2=181847&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue May 14 18:24:17 2013
>> @@ -1221,10 +1221,19 @@ bool Sema::CheckMessageArgumentTypes(Qua
>>     else
>>       DiagID = isClassMessage ? diag::warn_class_method_not_found
>>                               : diag::warn_inst_method_not_found;
>> -    if (!getLangOpts().DebuggerSupport)
>> +    if (!getLangOpts().DebuggerSupport) {
>>       Diag(SelLoc, DiagID)
>>         << Sel << isClassMessage << SourceRange(SelectorLocs.front(), 
>>                                                 SelectorLocs.back());
>> +      // Find the class to which we are sending this message.
>> +      if (ReceiverType->isObjCObjectPointerType()) {
>> +        QualType ClassType =
>> +          ReceiverType->getAs<ObjCObjectPointerType>()->getPointeeType();
>> +        if (const ObjCObjectType *ClassTPtr = ClassType->getAs<ObjCObjectType>())
>> +          if (ObjCInterfaceDecl *Class = ClassTPtr->getInterface())
>> +            Diag(Class->getLocation(), diag::note_receiver_class_declared);
>> +      }
>> +    }
> 
> You don't really need to double the ifs here. Just use ReceiverType->getAs<ObjCObjectPointerType>() and then ObjCObjectPointerType::getInterfaceDecl().

In r181896.
- Fariborz
> 
> 
>>     // In debuggers, we want to use __unknown_anytype for these
>>     // results so that clients can cast them.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130515/599acb52/attachment.html>


More information about the cfe-commits mailing list