[clang] [clang-format] Apply SpaceBeforeInheritanceColon to enum underlying types (PR #189011)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 29 13:46:53 PDT 2026


================
@@ -1444,9 +1444,9 @@ class AnnotatingParser {
                   Scopes.back() == ST_Class)) {
         Tok->setType(TT_BitFieldColon);
       } else if (Contexts.size() == 1 &&
-                 Line.getFirstNonComment()->isNoneOf(tok::kw_enum, tok::kw_case,
+                 Line.getFirstNonComment()->isNoneOf(tok::kw_case,
                                                      tok::kw_default) &&
-                 !Line.startsWith(tok::kw_typedef, tok::kw_enum)) {
+                 !Line.startsWith(tok::kw_typedef)) {
----------------
HazardyKnusperkeks wrote:

I think we should go in a different direction.
* Add a new Type in `FormatToken.h`
* Set said type in `UnwrappedLineParser::parseEnum()`
* Handle the new type, with the existing option in TokenAnnotator::spaceRequiredBetween()`

https://github.com/llvm/llvm-project/pull/189011


More information about the cfe-commits mailing list