diff options
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 92c467a40f9..6891930ead3 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -986,6 +986,8 @@ private: else if (Current->is(tok::semi) || Current->Type == TT_InlineASMColon || Current->Type == TT_ObjCSelectorName) return 0; + else if (Current->Type == TT_RangeBasedForLoopColon) + return prec::Comma; else if (Current->Type == TT_BinaryOperator || Current->is(tok::comma)) return Current->getPrecedence(); else if (Current->isOneOf(tok::period, tok::arrow)) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 0f112a13f19..c49faaa0b9b 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -416,6 +416,8 @@ TEST_F(FormatTest, RangeBasedForLoops) { " aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa, aaaaaaaaaaaaa)) {\n}"); verifyFormat("for (const aaaaaaaaaaaaaaaaaaaaa &aaaaaaaaa :\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {\n}"); + verifyFormat("for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa :\n" + " aaaaaaaaaaaa.aaaaaaaaaaaa().aaaaaaaaa().a()) {\n}"); } TEST_F(FormatTest, FormatsWhileLoop) { |