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

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 22 13:24:46 PDT 2021


Meinersbur added a comment.

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

> I think there is, but I'm an eternal optimist. :-) This LGTM, but you should wait a day or two before landing it in case @dblaikie or @rsmith have concerns.

Of course.



================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6059-6062
+    if (!types::isCXX(InputType) && !types::isOpenCL(InputType) &&
+        !types::isObjC(InputType) && !types::isCuda(InputType) &&
+        !types::isHIP(InputType) && InputType != types::TY_PP_C &&
+        InputType != types::TY_C)
----------------
aaron.ballman wrote:
> One downside to this approach as opposed to using a `switch` is that it'll be easy to add new languages and forget to update this. However, we don't do that particularly often and this will loudly tell users about the lack of support, so I think it's fine as-is.
I used the `types::isABC` functions because if a new input type is added, it will either be added to one of the `isABC` functions. If not, it would be save to not allow whitespace minimization with it until verified.

However, I did not think about the warning for missing enums. I am going to use a switch instead.


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