[PATCH] D25153: preprocessor supports `-dI` flag

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 16:33:52 PDT 2016


rsmith added inline comments.


> PrintPreprocessedOutput.cpp:320-321
> + * if we're emitting a '#'-style directive (escape both CR and LF).  Paths are quoted in some
> + * instances, so escape quotes.  Escaping is with a backslash (and backslashes themselves have
> + * to be escaped); for CR or LF, we use "\r" or "\n".
> + */

Do we really this? We're only using these sanitized paths within `/*...*/` comments, and generating a newline in that context seems fine. The only thing that seems necessary to escape is a `*/` within the path, which this doesn't handle.

> elsteveogrande wrote in PrintPreprocessedOutput.cpp:390
> The FIXME and hardcoded `#include` are copied from the clause just above this.  Seems getting the text for this token wasn't that easy.  I can try again and solve this in a future patch, if it's ok to let this ine slide, @rsmith.

This is fine for now.

> elsteveogrande wrote in dump_import.m:1
> Also: I should have said `^#include` at the end of this line.  Fortunately if the TODO is fixed, the preprocessor will report `#import` and this test will still work :)

It's still better to check for `#include` here with a FIXME in the test, since that way once we fix the issue, we'll know to update the test.

Repository:
  rL LLVM

https://reviews.llvm.org/D25153





More information about the cfe-commits mailing list