diff options
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index f10e68c3405..dec631fcfb3 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -574,7 +574,7 @@ private: (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) { Contexts.back().IsExpression = true; for (FormatToken *Previous = Current.Previous; - Previous && Previous->isNot(tok::comma); + Previous && !Previous->isOneOf(tok::comma, tok::semi); Previous = Previous->Previous) { if (Previous->is(tok::r_square)) Previous = Previous->MatchingParen; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 00ece1a6594..2500c8e4a71 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3825,6 +3825,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { "}"); verifyFormat("for (int i = a * a; i < 10; ++i) {\n}"); verifyFormat("for (int i = 0; i < a * a; ++i) {\n}"); + verifyGoogleFormat("for (int i = 0; i * 2 < z; i *= 2) {\n}"); verifyFormat("#define MACRO \\\n" " int *i = a * b; \\\n" |

