summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-08-01 22:05:00 +0000
committerDaniel Jasper <djasper@google.com>2013-08-01 22:05:00 +0000
commitb1ae734ffc668e5bd88c81527ce6e00d138be634 (patch)
tree8ea4c909855aace3b0eb026221ea1a2129e0c254 /clang/lib/Format/Format.cpp
parent975abffee754319411759b025c25a1eb0f3c047f (diff)
downloadbcm5719-llvm-b1ae734ffc668e5bd88c81527ce6e00d138be634.tar.gz
bcm5719-llvm-b1ae734ffc668e5bd88c81527ce6e00d138be634.zip
clang-format: Don't break empty 2nd operand of ternary expr.
Before: some_quite_long_variable_name_ptr ? : argv[9] ? ptr : argv[8] ? : argv[7] ? ptr : argv[6]; After: some_quite_long_variable_name_ptr ?: argv[9] ? ptr : argv[8] ?: argv[7] ? ptr : argv[6]; Patch by Adam Strzelecki, thank you!! This fixed llvm.org/PR16758. llvm-svn: 187622
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index f59fb37996e..b2bf3fea98d 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1237,7 +1237,8 @@ private:
return true;
}
if ((Previous.isOneOf(tok::comma, tok::semi) || Current.is(tok::question) ||
- Current.Type == TT_ConditionalExpr) &&
+ (Current.Type == TT_ConditionalExpr &&
+ !(Current.is(tok::colon) && Previous.is(tok::question)))) &&
State.Stack.back().BreakBeforeParameter &&
!Current.isTrailingComment() &&
!Current.isOneOf(tok::r_paren, tok::r_brace))
OpenPOWER on IntegriCloud