summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index c150c91e96a..41d30d1fce7 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1140,7 +1140,7 @@ private:
if (!Current || !Current->is(tok::question))
return;
next();
- parse(prec::LogicalOr);
+ parseConditionalExpr();
if (!Current || Current->Type != TT_ConditionalExpr)
return;
next();
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 2ac017c6f59..21bc8627546 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3941,6 +3941,11 @@ TEST_F(FormatTest, BreaksConditionalExpressions) {
" aaaaaaaaaaaaaaaaaaaaa +\n"
" aaaaaaaaaaaaaaaaaaaaa\n"
" : aaaaaaaaaa;");
+ verifyFormat(
+ "aaaaaa = aaaaaaaaaaaa\n"
+ " ? aaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ " : aaaaaaaaaaaaaaaaaaaaaa\n"
+ " : aaaaaaaaaaaaaaaaaaaaaaaaaaaa;");
FormatStyle NoBinPacking = getLLVMStyle();
NoBinPacking.BinPackParameters = false;
OpenPOWER on IntegriCloud