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 0034235c32d..f890af33deb 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -245,7 +245,7 @@ private: StartsObjCMethodExpr = false; Left->Type = TT_Unknown; } - if (StartsObjCMethodExpr) { + if (StartsObjCMethodExpr && CurrentToken->Previous != Left) { CurrentToken->Type = TT_ObjCMethodExpr; // determineStarAmpUsage() thinks that '*' '[' is allocating an // array of pointers, but if '[' starts a selector then '*' is a diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index d59ed6c0aff..c7bd44c12d2 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4473,6 +4473,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyIndependentOfContext("A<int *> a;"); verifyIndependentOfContext("A<int **> a;"); verifyIndependentOfContext("A<int *, int *> a;"); + verifyIndependentOfContext("A<int *[]> a;"); verifyIndependentOfContext( "const char *const p = reinterpret_cast<const char *const>(q);"); verifyIndependentOfContext("A<int **, int **> a;"); |