r177549 - Objective-C [qoi] more gracefull recovery when

jahanian fjahanian at apple.com
Wed Mar 20 11:26:15 PDT 2013


On Mar 20, 2013, at 11:15 AM, Jordan Rose <jordan_rose at apple.com> wrote:

> 
> On Mar 20, 2013, at 11:09 , Fariborz Jahanian <fjahanian at apple.com> wrote:
> 
>> +        Tok.setLocation(Tok.getLocation().getLocWithOffset(-1));
>> +        Tok.setKind(tok::at);
>> +        Tok.setLength(1);
> 
> This is not correct; Objective-C keywords can (sadly) be spelled with spaces. Is it possible to just keep the original token around instead of overwriting it when you read the next token?

Sadly no, because this introduces an overhead for the common case. Besides, we are handling the error case. We don’t care if it was “@ end” or @end.
> 
> Also, I'm not sure the implicit '}' is a good idea for anything but @end. If someone does make a typo writing @public, there'll be an unexpected close-brace later.

Agreed. This is the test case:
@interface A {
@property id PROP;
}
@end

I don’t think we can get this 100% clean in all cases. 

- Fariborz

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


More information about the cfe-commits mailing list