summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorFrancois Ferrand <thetypz@gmail.com>2017-05-22 08:28:17 +0000
committerFrancois Ferrand <thetypz@gmail.com>2017-05-22 08:28:17 +0000
commit9976efa8ffe039807dc7d2fad187471436bb3e73 (patch)
tree9e3b306567330ade455bc1ac4b6f2b621a47666b /clang/lib/Format/Format.cpp
parent89d733a505266a0c00c019faf8ab5cc438c71c05 (diff)
downloadbcm5719-llvm-9976efa8ffe039807dc7d2fad187471436bb3e73.tar.gz
bcm5719-llvm-9976efa8ffe039807dc7d2fad187471436bb3e73.zip
clang-format: Allow customizing the penalty for breaking assignment
Summary: Add option to customize the penalty for breaking assignment This allows increasing the priority of the assignment, to prefer spliting an operation instead of splitting the assignment, e.g. : int a = bbbbbbbbbbbbbbbb + cccccccccccccccc; Reviewers: krasimir, djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D32477 llvm-svn: 303534
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index c8677e80517..ac83379e6b1 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -343,6 +343,8 @@ template <> struct MappingTraits<FormatStyle> {
IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty);
IO.mapOptional("ObjCSpaceBeforeProtocolList",
Style.ObjCSpaceBeforeProtocolList);
+ IO.mapOptional("PenaltyBreakAssignment",
+ Style.PenaltyBreakAssignment);
IO.mapOptional("PenaltyBreakBeforeFirstCallParameter",
Style.PenaltyBreakBeforeFirstCallParameter);
IO.mapOptional("PenaltyBreakComment", Style.PenaltyBreakComment);
@@ -582,6 +584,7 @@ FormatStyle getLLVMStyle() {
LLVMStyle.SpaceBeforeAssignmentOperators = true;
LLVMStyle.SpacesInAngles = false;
+ LLVMStyle.PenaltyBreakAssignment = prec::Assignment;
LLVMStyle.PenaltyBreakComment = 300;
LLVMStyle.PenaltyBreakFirstLessLess = 120;
LLVMStyle.PenaltyBreakString = 1000;
OpenPOWER on IntegriCloud