[PATCH] Preprocessor: preserve whitespace in -traditional-cpp mode.

Richard Smith richard at metafoo.co.uk
Thu Feb 14 15:44:02 PST 2013


On Thu, Feb 14, 2013 at 2:42 PM, Jordan Rose <jordan_rose at apple.com> wrote:

>
>   Looking at this again, it's going to be hard to get LeadingSpace to be
> correct in all cases in keep-whitespace mode. I'm hesitant to add another
> variable like IsAtStartOfLine that will just slow down every token lexed in
> //non-//traditional mode.
>
>   (To do -traditional-cpp properly, we'd actually need LeadingSpace to be
> correct, because # only starts a directive if it's actually in the first
> column. But this patch doesn't do that anyway.)
>

I'm not sure how much sense it makes to teach Lexer to do -traditional-cpp
properly. The truly horrific parts of it (macro expansion within string
literals, /**/ concatenation, whitespace preservation, etc) make much more
sense with a character-stream model than a token-stream model.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130214/3fcdb31d/attachment.html>


More information about the cfe-commits mailing list