[PATCH] D120398: [format] follow up: Use unsigned char as the base of all enums in FormatStyle

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 27 06:29:06 PST 2022


HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.

The decision is made in the header (so I think it will always be `int` until this doesn't fit). To decide what is faster the compiler would need to know all the usages. Which it can't.

We have multiple times bit fields in `clang-format` to reduce the object size. I think it's only consistent to decrease the `FormatStyle` size.

The only reason I didn't do it for the enums introduced by me is consistency.

In D120398#3347726 <https://reviews.llvm.org/D120398#3347726>, @MyDeveloperDay wrote:

> Is there a clang-tidy check for this? I mean if we are doing this because it helps reduce the size of FormatStyle and its recommended practice for small enums, then we should have a clang-tidy check that catches us on this. (no?)

None that I'm aware of.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120398



More information about the cfe-commits mailing list