summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 5f13d103a6b..2fe1e24709c 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -501,6 +501,12 @@ private:
}
if (StartsObjCMethodExpr && CurrentToken->Previous != Left) {
CurrentToken->Type = TT_ObjCMethodExpr;
+ // If we haven't seen a colon yet, make sure the last identifier
+ // before the r_square is tagged as a selector name component.
+ if (!ColonFound && CurrentToken->Previous &&
+ CurrentToken->Previous->is(TT_Unknown) &&
+ canBeObjCSelectorComponent(*CurrentToken->Previous))
+ CurrentToken->Previous->Type = TT_SelectorName;
// determineStarAmpUsage() thinks that '*' '[' is allocating an
// array of pointers, but if '[' starts a selector then '*' is a
// binary operator.
OpenPOWER on IntegriCloud