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

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 4 22:58:52 PDT 2021


Meinersbur added a comment.

In D104601#3105044 <https://reviews.llvm.org/D104601#3105044>, @manmanren wrote:

> It will fail the compilation on the preprocessed output with
> error: expected unqualified-id
> int test();#pragma clang assume_nonnull end

The handler for assume_nonull passes an invalid SourceLocation if embedded in in a _Pragma. Not sure whether this is already a bug, but we should insert semantically relevant newlines even if the line for the #pragma is unknown. Fixed in rG1606022fab2d90ed8ee6d15800ec1c2c293db20e <https://reviews.llvm.org/rG1606022fab2d90ed8ee6d15800ec1c2c293db20e>. Thanks for the report.



================
Comment at: clang/lib/Frontend/PrintPreprocessedOutput.cpp:680
+    if (RequireSpace || (!MinimizeWhitespace && Tok.hasLeadingSpace()) ||
+        ((EmittedTokensOnThisLine || EmittedTokensOnThisLine) &&
+         AvoidConcat(PrevPrevTok, PrevTok, Tok)))
----------------
RKSimon wrote:
> @Meinersbur Static analysis is warning that these are both the same - should one be EmittedDirectiveOnThisLine ?
Fixed in rG8f099d17a1bee857ada3c5af032cfcb559252024. Thanks for the report and sorry for not seeing you comment until now.


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