[PATCH] D135872: [clang-format] Handle unions like structs and classes
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 13 05:41:49 PDT 2022
HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: MyDeveloperDay, curdeius, owenpan, rymiel.
HazardyKnusperkeks added a project: clang-format.
Herald added a project: All.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135872
Files:
clang/lib/Format/TokenAnnotator.cpp
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -3157,7 +3157,7 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135872.467455.patch
Type: text/x-patch
Size: 463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221013/7e4bc58b/attachment.bin>
More information about the cfe-commits
mailing list