projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
11b8795
)
[clang-format] Handle unions like structs and classes
author
Björn Schäpers
<bjoern@hazardy.de>
Tue, 11 Oct 2022 07:04:28 +0000
(09:04 +0200)
committer
Björn Schäpers
<bjoern@hazardy.de>
Mon, 24 Oct 2022 19:28:12 +0000
(21:28 +0200)
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
patch
|
blob
|
history
diff --git
a/clang/lib/Format/TokenAnnotator.cpp
b/clang/lib/Format/TokenAnnotator.cpp
index
076ceb7
..
944bea5
100644
(file)
--- 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;