diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 1 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 62ec93f3234..d3d4bb14fdb 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -765,6 +765,7 @@ private: Previous && Previous->isOneOf(tok::star, tok::amp); Previous = Previous->Previous) Previous->Type = TT_PointerOrReference; + Contexts.back().IsExpression = false; } 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 9d62fbe14fa..3485392d4fd 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4984,6 +4984,9 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyGoogleFormat( "const char* const p = reinterpret_cast<const char* const>(q);"); verifyGoogleFormat("void f(int i = 0, SomeType** temps = NULL);"); + verifyGoogleFormat("void f(Bar* a = nullptr, Bar* b);"); + verifyGoogleFormat("template <typename T>\n" + "void f(int i = 0, SomeType** temps = NULL);"); FormatStyle Left = getLLVMStyle(); Left.PointerAlignment = FormatStyle::PAS_Left; |