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

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 22 03:27:09 PDT 2021


Meinersbur added a comment.

I compiled the Linux kernel (default config, excludes most drivers. Takes ~18mins to compile) and indeed found two problems:

1. Linux contains `assembler-with-cpp` files. When compiling with clang, it processes it with `-E` before passing the result to `as`. There are different rules on whether whitespace can be completely removed (`AvoidConcat`) in asm files. I changed `ccache` to not pass `-fminimize-whitespace` to assembler files and added an error if one tries.

2. Line breaks outside of macros are (more) significant in assembler files. I tried to rely more on `Tok.getLocation()` than `Tok.isAtStartOfLine()` (which is pretty unreliable) to determine line breaks, which unfortunately caused differences even without `-fminimize-whitespace`. The patch is using `Tok.isAtStartOfLine()` again.

The clang-13 release branch will be created on July 27. Is there any hope to get this merged by then?


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