From c5755f44f0cfcd90aa130497eb114f94182ebc69 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Tue, 11 Oct 2022 09:04:28 +0200 Subject: [PATCH] [clang-format] Handle unions like structs and classes There is no reason why unions should be handled differently, I think they are just forgotten since they are not used that often. No test case added, since that would be complicated to produce. Differential Revision: https://reviews.llvm.org/D135872 --- clang/lib/Format/TokenAnnotator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 076ceb7..944bea5 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -3157,7 +3157,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, return 160; if (Left.is(TT_CastRParen)) return 100; - if (Left.isOneOf(tok::kw_class, tok::kw_struct)) + if (Left.isOneOf(tok::kw_class, tok::kw_struct, tok::kw_union)) return 5000; if (Left.is(tok::comment)) return 1000; -- 2.7.4