> 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).

> 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 <[email protected]> wrote:
> 
>> On Jul 23, 2015, at 8:33 AM, AlexDenisov <[email protected]> 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
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to