diff options
Diffstat (limited to 'clang')
| -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 864f60dee62..dfd880aa997 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -764,7 +764,7 @@ private: Previous = Previous->Previous) Previous->Type = TT_PointerOrReference; if (Line.MustBeDeclaration) - Contexts.back().IsExpression = Contexts.back().InCtorInitializer; + Contexts.back().IsExpression = Contexts.front().InCtorInitializer; } else if (Current.Previous && Current.Previous->Type == TT_CtorInitializerColon) { Contexts.back().IsExpression = true; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 1fd95f04869..cada2bf6d7f 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5009,6 +5009,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyIndependentOfContext("aaa && aaa->f();"); verifyIndependentOfContext("int x = ~*p;"); verifyFormat("Constructor() : a(a), area(width * height) {}"); + verifyFormat("Constructor() : a(a), area(a, width * height) {}"); verifyFormat("void f() { f(a, c * d); }"); verifyIndependentOfContext("InvalidRegions[*R] = 0;"); |

