diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1337,11 +1337,11 @@ if (CurrentToken && CurrentToken->isOneOf(Keywords.kw_mark, Keywords.kw_option, Keywords.kw_region)) { - bool IsMark = CurrentToken->is(Keywords.kw_mark); + bool IsMarkOrRegion = CurrentToken->isOneOf(Keywords.kw_mark, Keywords.kw_region); next(); next(); // Consume first token (so we fix leading whitespace). while (CurrentToken) { - if (IsMark || CurrentToken->Previous->is(TT_BinaryOperator)) + if (IsMarkOrRegion || CurrentToken->Previous->is(TT_BinaryOperator)) CurrentToken->setType(TT_ImplicitStringLiteral); next(); } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -19968,6 +19968,11 @@ EXPECT_EQ("#pragma region TEST(FOO : BAR)", format("#pragma region TEST(FOO : BAR)", Style)); + + verifyFormat("#pragma region TEST(FOO: NOSPACE)", Style); + EXPECT_EQ("#pragma region TEST(FOO: NOSPACE)", + format("#pragma region TEST(FOO: NOSPACE)", Style)); + } TEST_F(FormatTest, OptimizeBreakPenaltyVsExcess) {