Changed name of the Lookup… method, now it’s even better, imho.

Attachment: lookup_objc_interface_decl_for_literal.patch
Description: Binary data

> On 23 Jul 2015, at 22:46, John McCall <rjmcc...@apple.com> wrote:
> 
> 
>> On Jul 23, 2015, at 1:43 PM, AlexDenisov <1101.deb...@gmail.com> wrote:
>> 
>>> I think it would make more sense to have this take an ObjCLiteralKind
>>> and then map that to a NSAPI::NSClassIdKindKind than the other way
>>> around.
>> 
>> It was my initial idea, but I’m stuck with default value in case
>> when ObjCLiteralKind doesn’t match any NSClassIdKindKind (e.g.: LK_Block or 
>> LK_None).
> 
> Feel free to just assert that these aren’t passed by putting an
> llvm_unreachable in those cases.
> 
> John.
> 
>>> You should declare variables as close as possible to the point they’re 
>>> initialized,
>>> and you should try to avoid naming variables the same as a type.
>> 
>> Will do.
>> 
>>> On 23 Jul 2015, at 22:29, John McCall <rjmcc...@apple.com> wrote:
>>> 
>>>> On Jul 23, 2015, at 8:33 AM, AlexDenisov <1101.deb...@gmail.com> wrote:
>>>>> Then, on the Sema side, you should define an enum that corresponds to
>>>>> the different cases in that second parameter.
>>>> 
>>>> I just reused ObjCLiteralKind, seems it fits for this task very well.
>>> 
>>> Sounds good.
>>> 
>>>>> If you do this, you should be able to unify all the different diagnostics 
>>>>> for
>>>>> NSNumber/NSArray/NSValue.
>>>> 
>>>> Merged all specific errors into one err_undeclared_objc_literal_class, as 
>>>> you suggested.
>>>> 
>>>> New version attached.
>>>> 
>>>> <lookup_objc_literal_interface_decl.patch>
>>> 
>>> +static bool ValidateObjCLiteralInterfaceDecl(Sema &S, ObjCInterfaceDecl 
>>> *Decl,
>>> +                                             SourceLocation Loc,
>>> +                                             NSAPI::NSClassIdKindKind 
>>> ClassKind) {
>>> 
>>> I think it would make more sense to have this take an ObjCLiteralKind
>>> and then map that to a NSAPI::NSClassIdKindKind than the other way
>>> around.
>>> 
>>> +  ObjCInterfaceDecl *Decl = nullptr;
>>> +  IdentifierInfo *II = S.NSAPIObj->getNSClassId(ClassKind);
>>> +  NamedDecl *IF = S.LookupSingleName(S.TUScope, II, Loc,
>>> +                                     Sema::LookupOrdinaryName);
>>> +  Decl = dyn_cast_or_null<ObjCInterfaceDecl>(IF);
>>> 
>>> You should declare variables as close as possible to the point they’re 
>>> initialized,
>>> and you should try to avoid naming variables the same as a type.
>>> 
>>> So, specifically, please make this
>>> ObjCInterfaceDecl *ID = dyn_cast_or_null<ObjCInterfaceDecl>(IF);
>>> 
>>> Otherwise, this looks good, thanks!
>>> 
>>> John.
>> 
> 

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to