[cfe-commits] [PATCH] Fixits for smart quotes and other Unicode characters

Richard Smith richard at metafoo.co.uk
Fri Aug 10 18:13:34 PDT 2012


On Fri, Aug 10, 2012 at 5:56 PM, Jordan Rose <jordan_rose at apple.com> wrote:

> Hi, everyone. I've been working on and off on PR13178, which would provide
> nice fixits and recovery for Unicode smart quotes and ellipses, and better
> diagnosis of other spurious non-ASCII characters. I have all the
> functionality in place, but see a dramatic (>5%) slowdown when parsing
> Cocoa.h (-fsyntax-only). I've tried as much as I can to keep the
> smart-quote-specific code out of the string literal loops, but certain
> pieces just can't be avoided. I don't think we want this fixit at the cost
> of the common correct case.
>

I suspect most of the extra cost here is coming from the "case '\xE2' in
LexNextToken, not from the string literal lexing. Have you tried sinking
that into the 'if ((Char & 0x80) != 0)' in the default case? That might
also benefit from being marked as unlikely.

I've not looked at the patch in detail yet. One thing I spotted in passing:
your diagnostic messages should start with a lowercase letter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120810/599afbaa/attachment.html>


More information about the cfe-commits mailing list