[PATCH] D104601: [Preprocessor] Implement -fnormalize-whitespace.

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 29 13:43:48 PDT 2021


Meinersbur added a comment.

In D104601#2847400 <https://reviews.llvm.org/D104601#2847400>, @aaron.ballman wrote:

> ... would add that it's very common for implementers to ask developers to run their code through `-E` mode to submit preprocessed output in order to reproduce a customer issue with the compiler, and I worry that uses of this flag will have unintended consequences in that scenario.

Why would one add `-fnormalize-whitespace` for this use case?

> The "very long line" example mentioned by @dblaikie is sort of along these lines (sorry for the bad pun).

I can add a forced line breaks (after/before 80 cols? configurable?) if requested.



================
Comment at: clang/lib/Frontend/PrintPreprocessedOutput.cpp:174
+  ///                        on being on the same line, such as directives.
+  void HandleWhitespaceBeforeTok(Token &Tok, bool RequireSpace,
+                                 bool RequireSameLine);
----------------
aaron.ballman wrote:
> Can `Tok` be `const Token &` instead?
Note that this is a renamed `bool HandleFirstTokOnLine(Token &Tok)`. Renamed because it is now called for every token.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104601/new/

https://reviews.llvm.org/D104601



More information about the cfe-commits mailing list